Skip to content

feat(cli): support for reading and writing messages from/to files #1629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 22, 2024

Conversation

DM1-1
Copy link
Contributor

@DM1-1 DM1-1 commented Apr 19, 2024

PR Checklist

If you have any questions, you can refer to the Contributing Guide

What is the current behavior?

The current behavior of the CLI does not support reading and writing messages from/to files.

Issue Number

What is the new behavior?

The new behavior introduced by this PR allows the CLI to read messages from and write messages to files. This enhancement includes support for binary format for message representation.

Does this PR introduce a breaking change?

  • Yes
  • No (Assuming the new feature is backward compatible and does not break existing functionality)

Specific Instructions

  • Ensure that the file reading and writing functions are thoroughly tested with various file sizes and binary formats.
  • Verify that the new feature does not introduce any performance degradation in the CLI.
  • Refactoring the previous code related to saving/loading configuration into a new utility file for handling file operations.

Other information

@DM1-1 DM1-1 added feature This pr is a feature CLI MQTTX CLI labels Apr 19, 2024
@DM1-1
Copy link
Contributor Author

DM1-1 commented Apr 19, 2024

base64/hex
image


json/cbor
image


binary
image


loading for pub
image


--file-save
image


--file-write
image
image

@DM1-1 DM1-1 requested review from ysfscream and Red-Asuka and removed request for ysfscream April 19, 2024 07:14
@DM1-1 DM1-1 marked this pull request as ready for review April 19, 2024 07:14
@DM1-1
Copy link
Contributor Author

DM1-1 commented Apr 19, 2024

save & load config
image

@Red-Asuka Red-Asuka requested a review from ysfscream April 19, 2024 08:16
@Red-Asuka Red-Asuka added this to the v1.10.0 milestone Apr 19, 2024
@ysfscream
Copy link
Member

@DM1-1 GOOD JOB 👍

But I have a question: if we have successfully written it into the file, is it still necessary to print the information to the console? @Red-Asuka

@Red-Asuka
Copy link
Member

@ysfscream I think --file-save does not need to print the specific message content, just output the path of the saved file. --file-write is generally used for continuous writing of readable text, it needs to output specific message content, but you can adjust the order, first output the message content, then prompt that the file was successfully written.

@DM1-1 DM1-1 force-pushed the dm/feat-cli branch 4 times, most recently from 41e3f61 to f29c661 Compare April 22, 2024 08:38
@Red-Asuka Red-Asuka merged commit 25412b0 into emqx:main Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI MQTTX CLI feature This pr is a feature
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants