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

Convert yargs builder function to options object on subcommands #708

Closed
0x2b3bfa0 opened this issue Sep 9, 2021 · 0 comments · Fixed by #712
Closed

Convert yargs builder function to options object on subcommands #708

0x2b3bfa0 opened this issue Sep 9, 2021 · 0 comments · Fixed by #712
Assignees
Labels
enhancement New feature or request technical-debt Refactoring, linting & tidying ui/ux User interface/experience

Comments

@0x2b3bfa0
Copy link
Member

0x2b3bfa0 commented Sep 9, 2021

Follow-up of #703

The current builder pattern allows different settings of the same option to be sprinkled between the others, and we haven't missed the opportunity to have a few options spread all over the place. We should proabably use a single options object instead.

Editor's picks

🧐 Nonexistent --cloud-gpu-type option, giving us trouble since #362

cml/bin/cml/runner.js

Lines 473 to 476 in 60ff630

.default('cloud-gpu')
.describe('cloud-gpu', 'GPU type.')
.choices('cloud-gpu', ['nogpu', 'k80', 'v100', 'tesla'])
.coerce('cloud-gpu-type', (val) => (val === 'nogpu' ? null : val))

🎲 Random use of implicit .default('option') versus omitting it completely

...with the only difference being {option: undefined} versus {} in the resulting object.

.default('cloud')

🙈 Interleaved builder function calls for different options

.default('file')
.describe(
'file',
'Append the output to the given file. Create it if does not exist.'
)
.describe('rm-watermark', 'Avoid CML watermark.')
.alias('file', 'f');

🚯 Incomplete option definitions with no effect

.default('plugins')

@0x2b3bfa0 0x2b3bfa0 changed the title Replace yargs builder functions by builder objects on subcommands Convert yargs builder function to options object on subcommands Sep 9, 2021
@0x2b3bfa0 0x2b3bfa0 self-assigned this Sep 9, 2021
@0x2b3bfa0 0x2b3bfa0 added enhancement New feature or request technical-debt Refactoring, linting & tidying ui/ux User interface/experience labels Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request technical-debt Refactoring, linting & tidying ui/ux User interface/experience
Projects
None yet
1 participant