Skip to content

Comments

some changes#2

Open
yuvalyacoby wants to merge 8 commits intomasterfrom
outdated-comments-play
Open

some changes#2
yuvalyacoby wants to merge 8 commits intomasterfrom
outdated-comments-play

Conversation

@yuvalyacoby
Copy link
Owner

@yuvalyacoby yuvalyacoby commented Sep 9, 2024

User description

User description

bla bla

Pull Request

Problem

Solution

ChangeLog


Generated description

Below is a concise technical summary of the changes proposed in this PR:

Refactor option handling in lib/command.js to improve error messaging and source tracking. Update lib/help.js to modify the return structure of visible options. Adjust lib/option.js to correct the negation logic for long flags.

TopicDetails
Help Options Update lib/help.js to modify the return structure of visible options.
Modified files (1)
  • lib/help.js
Checks8
  • build / Test on node 20.x and windows-latest
  • build / Test on node 20.x and ubuntu-latest
  • build / Test on node 18.x and macos-latest
  • build / Test on node 18.x and ubuntu-latest
  • build / Test on node 20.x and macos-latest
  • build / Test on node 22.x and ubuntu-latest
  • build / Test on node 22.x and macos-latest
  • build / Test on node 22.x and windows-latest
Latest Contributors(2)
UserCommitDate
john@ruru.gen.nzFix-some-JSDoc-lint-is...April 07, 2024
aweebit64@gmail.comUse-_getCommandAndAnce...August 10, 2023
Option Negation Adjust lib/option.js to correct the negation logic for long flags.
Modified files (1)
  • lib/option.js
Latest Contributors(2)
UserCommitDate
john@ruru.gen.nzFix-some-JSDoc-lint-is...April 07, 2024
j.gee@adinstruments.comAdd-extended-conflicts...March 14, 2022
Option Handling Refactor option handling in lib/command.js to improve error messaging and source tracking.
Modified files (1)
  • lib/command.js
Checks9
  • build / Test on node 20.x and macos-latest
  • build / Test on node 18.x and macos-latest
  • build / Test on node 20.x and ubuntu-latest
  • build / Test on node 22.x and windows-latest
  • build / Test on node 22.x and ubuntu-latest
  • build / Test on node 20.x and windows-latest
  • build / Test on node 18.x and ubuntu-latest
  • build / Test on node 22.x and macos-latest
  • build / Test on node 18.x and windows-latest
Latest Contributors(2)
UserCommitDate
john@ruru.gen.nzFix-some-JSDoc-lint-is...April 07, 2024
s@mg.svFix-Use-node-prefixed-...April 06, 2024
This pull request is reviewed by Baz. Join @yuvalyacoby and the rest of your team on (Baz).

lib/command.js Outdated
if (option.negate) {
// --no-foo is special and defaults foo to true, unless a --foo option is already defined
const positiveLongFlag = option.long.replace(/^--no-/, '--');
const positiveLongFlag = option.long.replace(/^--yes-/, '--');
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be no

lib/command.js Outdated

this.on('option:' + oname, (val) => {
const invalidValueMessage = `error: option '${option.flags}' argument '${val}' is invalid.`;
const invalidValueMessage = `errors: option '${option.flags}' argument '${val}' is invalid.`;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this

lib/help.js Outdated
*/

visibleArguments(cmd) {
_visibleArguments(cmd) {
Copy link
Owner Author

@yuvalyacoby yuvalyacoby Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why make it private? please change back to visibleArguments

lib/help.js Outdated
cmd.registeredArguments.forEach((argument) => {
argument.description =
argument.description || cmd._argsDescription[argument.name()] || '';
argument.description || cmd._argsDescription[argument.name()] || 'test';
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you changed it to test ?

lib/command.js Outdated

this.on('option:' + oname, (val) => {
const invalidValueMessage = `error: option '${option.flags}' argument '${val}' is invalid.`;
const invalidValueMessage = `errors: option option '${option.flags}' argument '${val}' is invalid.`;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const invalidValueMessage = `errors: option option '${option.flags}' argument '${val}' is invalid.`;
const invalidValueMessage = `errors: option option bla bla bla '${option.flags}' argument '${val}' is invalid.`;

lib/help.js Outdated
visibleOptions.sort(this.compareOptions);
}
visibleOptions.sort(this.compareOptions);
return visibleOptions;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should return an object?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why object?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the order service is expecting an object

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

lib/command.js Outdated
@@ -690,7 +690,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
};

this.on('option:' + oname, (val) => {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should change this to regular function?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? its fine like this

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change it to regular function, not arrow

lib/command.js Outdated

if (option.envVar) {
this.on('optionEnv:' + oname, (val) => {
const invalidValueMessage = `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const invalidValueMessage = `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`;
const invalidValueMessage = `error: option test test test '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`;

lib/command.js Outdated
@@ -689,14 +689,19 @@ Expecting one of '${allowedValues.join("', '")}'`);
this.setOptionValueWithSource(name, val, valueSource);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1

this.setOptionValueWithSource(name, val, valueSource);
};

this.on('option:' + oname, (val) => {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2

lib/command.js Outdated



if (option.envVar) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use the localVar instead envVar field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant