Skip to content

Feature: Adding .conflicts() where applicable to make flags exclusive#104

Open
brycentrivir wants to merge 2 commits into
mainfrom
feature/make-flags-exclusive
Open

Feature: Adding .conflicts() where applicable to make flags exclusive#104
brycentrivir wants to merge 2 commits into
mainfrom
feature/make-flags-exclusive

Conversation

@brycentrivir

Copy link
Copy Markdown

CommanderJS has a feature of .conflicts() that can be added to the Option object to assign conflicting flags/options making them exclusive.

Only weird thing was to get .conflicts to work, we had to add its metadata to the cloneOption happening in FrodoCommand.ts. Commander has a typing error in the node_modules so for now we are using @ts-expect-error for each line that adds that until they fix it. The linter will create the new line so usage is for each line as @ts-expect-error doesn't have multi line functionality.

@phalestrivir phalestrivir left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Lots of missing things. I think I got all of them, but only in the files that you modified. Make sure to update the messages for all of the conflicts that I mentioned.

There are some new commands I think since you made this PR, so you will want to rebase as well and check which commands were added, and verify those ones don't need to be updated.

'[Other] id. If specified, -a and -A are ignored.'
)
'[Other] id. If specified, -a and -A cannot be used.'
).conflicts(['all', 'allSeparate'])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There is no allSepararte for this command

Comment thread src/cli/app/app-delete.ts
'Application name. If specified, -a is ignored.'
)
'Application name. If specified, -a cannot be used.'
).conflicts(['all'])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

'appId' is missing from this

'Application id. If specified, -n cannot be used.'
).conflicts(['appName'])
)
.addOption(new Option('-n, --app-name <name>', 'Application name.'))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Forgot to add conflicts with 'appId' for app name here

Comment thread src/cli/app/app-export.ts
'Application name. If specified, -a and -A are ignored.'
)
'Application name. If specified, -a and -A cannot be used.'
).conflicts(['all', 'allSeparate'])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing 'appId' here

Comment thread src/cli/app/app-import.ts
'Application name. If specified, only one application is imported and the options -a and -A are ignored.'
)
'Application name. If specified, only one application is imported and the options -a and -A cannot be used.'
).conflicts(['all', 'allSeparate'])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing 'appId' here

'[Something] id. If specified, -a and -A cannot be used.'
).conflicts(['all', 'allSeparate'])
)
.addOption(new Option('-f, --file <file>', 'Name of the export file.'))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing allSeparate

'Import all [else] from separate files (*.[else].json) in the current directory. Ignored with -i or -a.'
)
'Import all [else] from separate files (*.[else].json) in the current directory. Cannot be used with -i or -a.'
).conflicts(['elseID', 'all'])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing file

'[Else] id. If specified, only one [else] is imported and the options -a and -A cannot be used.'
).conflicts(['all', 'allSeparate'])
)
.addOption(new Option('-f, --file <file>', 'Name of the file to import.'))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing allSeparate

'Export all [else] to separate files (*.[else].json) in the current directory. Ignored with -i or -a.'
)
'Export all [else] to separate files (*.[else].json) in the current directory. Cannot be used with -i or -a.'
).conflicts(['elseId', 'all'])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing file

'[Else] id. If specified, -a and -A cannot be used.'
).conflicts(['all', 'allSeparate'])
)
.addOption(new Option('-f, --file <file>', 'Name of the export file.'))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing allSeparate

@phalestrivir phalestrivir left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Lots of missing things. I think I got all of them, but only in the files that you modified. Make sure to update the messages for all of the conflicts that I mentioned.

There are some new commands I think since you made this PR, so you will want to rebase as well and check which commands were added, and verify those ones don't need to be updated.

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.

2 participants