Skip to content
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

improve(cli): enhance handleLoadOptions to accept existing options #1811

Merged
merged 5 commits into from
Nov 15, 2024

Conversation

Red-Asuka
Copy link
Member

@Red-Asuka Red-Asuka commented Nov 15, 2024

Issue Number

#1809

What is the new behavior?

This pull request includes several changes to the cli package, focusing on improving the handling of options and adding pre-action hooks to commands. The most important changes include adding tests for saving and loading options, adding pre-action hooks to commands, and updating the handleLoadOptions function to merge options correctly.

Improvements to option handling:

  • cli/src/__tests__/utils/options.test.ts: Added comprehensive tests for saving and loading options for different command types, ensuring that options are correctly persisted and retrieved.
  • cli/src/utils/options.ts: Updated the handleLoadOptions function to merge the current command options with the loaded options, and added the filterOptions function to filter options based on their source. [1] [2]
  • cli/src/lib/conn.ts, cli/src/lib/pub.ts, cli/src/lib/sub.ts: Updated the handleLoadOptions function calls to include the current command options as a parameter for merging. [1] [2] [3] [4] [5] [6]

Command enhancements:

Type and import improvements:

Does this PR introduce a breaking change?

  • Yes
  • No

Specific Instructions

Are there any specific instructions or things that should be known prior to review?

Other information

@Red-Asuka Red-Asuka added enhancement New feature or request CLI MQTTX CLI labels Nov 15, 2024
@Red-Asuka Red-Asuka added this to the v1.11.1 milestone Nov 15, 2024
@Red-Asuka Red-Asuka requested a review from ysfscream November 15, 2024 02:47
@Red-Asuka Red-Asuka self-assigned this Nov 15, 2024
@ysfscream
Copy link
Member

The options file also supports YAML. Add it as a fork update to the test cases to cover more comprehensively. I have no other issues. @Red-Asuka

@ysfscream ysfscream merged commit dd49696 into main Nov 15, 2024
6 checks passed
@ysfscream ysfscream deleted the lyd/dev branch November 15, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI MQTTX CLI enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants