• Christian Kellner's avatar
    boltctl: refactor sub-comannd invocation · 6de6d8b0
    Christian Kellner authored
    Create a more generic SubCommand infrastructure that abstracts
    having a (NULL terminated) list of sub-commands and utility
    functions, i.e. _find & _run, to work with that list.
    
    subcommand_run will partly rewrite the argv with the following
    rules:
    
      argv[0] = 'boltctl' -> args[0] = boltctl config
      argv[1] = 'config'  |  args[1] = set
      argv[2] = 'set'     |  args[2] = x=5
      argv[3] = 'x=4'     |  args[3] = NULL
      argv[4] = NULL
      => argc = 4 -> count = 3
    
      argv[0] = 'boltctl' -> args[0] = boltctl config
      argv[1] = 'config'  |  args[1] = set
      argv[2] = 'set'     |  args[2] = NULL
      argv[3] = NULL      |
      => argc = 3 -> count = 2
    
      argv[0] = boltctl   -> args[0] = boltctl
      argv[1] = NULL      |  args[1] = NULL
      argc = 1 -> count = 1
    
      argv[0] = boltctl  | args[0] = botclt list
      argv[1] = list     | args[1] = NULL
      argv[2] = NULL     |
      argc = 2 -> count = 1
    6de6d8b0
Name
Last commit
Last update
boltd Loading commit data...
cli Loading commit data...
common Loading commit data...
contrib Loading commit data...
data Loading commit data...
docs Loading commit data...
policy Loading commit data...
scripts Loading commit data...
tests Loading commit data...
.editorconfig Loading commit data...
.flake8 Loading commit data...
.gitignore Loading commit data...
.gitlab-ci.yml Loading commit data...
.travis.yml Loading commit data...
BUGS.md Loading commit data...
COPYING Loading commit data...
HACKING.md Loading commit data...
INSTALL.md Loading commit data...
README.md Loading commit data...
config.h.in Loading commit data...
meson.build Loading commit data...
meson_options.txt Loading commit data...