attic-labs / noms

The versioned, forkable, syncable database
Apache License 2.0
7.44k stars 266 forks source link

Show only immediate child commands in help text #3828

Open aboodman opened 5 years ago

aboodman commented 5 years ago

The help text for the noms command is getting pretty hairy because of all the nested subcommands for things like noms struct and noms list.

Kingpin has a builtin ability to provide different templates (via UsageTemplate()) and one of them is more compact:

Commands:
  help [<command>...]
  commit [<flags>] [<absolute-path>] [<database>]
  config
  diff [<flags>] <object1> <object2>
  ds [<flags>] [<database>]
  log [<flags>] <path-spec>
  merge [<flags>] <database> <left-dataset-name> <right-dataset-name> <output-dataset-name>
  root [<flags>] <database>
  serve [<flags>] <database>
  show [<flags>] <object>
  sync [<flags>] <source-object> <dest-dataset>
  version
  blob
    put [<flags>] <file> <dataset>
    export <dataset> [<file>]
  list
    new <database> [<items>...]
    append <spec> [<items>...]
    insert <pos> <spec> [<items>...]
    del <spec> <pos> <len>
  map
    new <database> [<entries>...]
    set <spec> [<entries>...]
    del <spec> [<keys>...]
  set
    new <database> [<items>...]
    insert <spec> [<items>...]
    del <spec> [<items>...]
  stats <database>
  struct
    new [<flags>] <database> [<fields>...]
    set <spec> [<fields>...]
    del <spec> [<fields>...]
  splore [<flags>] <database or path>

... but it still seems like a bit much. Plus that template elides the short summary of what each top-level command does, which is useful.

I think we should instead create a new template that just omits the nested commands. This is what other things I have seen that have deep command hierarchies do.