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

use objects instead of arrays in cli config #37

Open
jaeh opened this issue Jan 11, 2020 · 0 comments
Open

use objects instead of arrays in cli config #37

jaeh opened this issue Jan 11, 2020 · 0 comments

Comments

@jaeh
Copy link
Member

jaeh commented Jan 11, 2020

const cliArgs = {
  options: [
    ['--arg1', '--a1'],
    ['--arg2', '--a2'],
  ],
  commands: [['cmd1', 'c1'] ['cmd2', 'c2']],
}

turns into:

const cliArgs = {
  options: {
    '--arg1': { alias: '--a1' },
    '--arg2': { alias: '--a2', }
  ],
  commands: {
    cmd1: { alias: 'c1', options: ['--c1arg1'] }, 
    cmd2: { alias: 'c2' },
  },
}

commands.cmd1.options is interesting here,
every command basically could turn into a separate cli,
including: help, default, required, options, subcommands.

once this change is implemented and the parsing works,
clis of arbitrary complexity will be configurable.

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

No branches or pull requests

1 participant