Feature: Adding .conflicts() where applicable to make flags exclusive#104
Feature: Adding .conflicts() where applicable to make flags exclusive#104brycentrivir wants to merge 2 commits into
Conversation
phalestrivir
left a comment
There was a problem hiding this comment.
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']) |
There was a problem hiding this comment.
There is no allSepararte for this command
| 'Application name. If specified, -a is ignored.' | ||
| ) | ||
| 'Application name. If specified, -a cannot be used.' | ||
| ).conflicts(['all']) |
| 'Application id. If specified, -n cannot be used.' | ||
| ).conflicts(['appName']) | ||
| ) | ||
| .addOption(new Option('-n, --app-name <name>', 'Application name.')) |
There was a problem hiding this comment.
Forgot to add conflicts with 'appId' for app name here
| 'Application name. If specified, -a and -A are ignored.' | ||
| ) | ||
| 'Application name. If specified, -a and -A cannot be used.' | ||
| ).conflicts(['all', 'allSeparate']) |
| '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']) |
| '[Something] id. If specified, -a and -A cannot be used.' | ||
| ).conflicts(['all', 'allSeparate']) | ||
| ) | ||
| .addOption(new Option('-f, --file <file>', 'Name of the export file.')) |
| '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']) |
| '[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.')) |
| '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']) |
| '[Else] id. If specified, -a and -A cannot be used.' | ||
| ).conflicts(['all', 'allSeparate']) | ||
| ) | ||
| .addOption(new Option('-f, --file <file>', 'Name of the export file.')) |
phalestrivir
left a comment
There was a problem hiding this comment.
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.
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.