Skip to content

Commit

Permalink
Merge "tools: make cli command-based" from Botond
Browse files Browse the repository at this point in the history
"
Currently commands are regular switches. This has several disadvantages:
* CLI programs nowadays use the command-based UX, so our tools are
  awkward to use to anybody used to that;
* They don't stand out from regular options;
* They are parsed at the same time as regular options, so all options
  have to be dumped to a single description;

This series migrates the tools to the command based CLI. E.g. instead of

    scylla sstable --validate --merge /path/to/sst1 /path/to/sst2

we now have:

    scylla sstable validate --merge /path/to/sst1 /path/to/sst2

Which makes it much clearer that "validate" is the command and "merge"
is an option. And it just looks better.

Internally the command is parsed and popped from argv manually just as
we do with the tool name in scylla main(). This means we know the
command before even building the
boost::program_options::options_description representation and thus
before creating the seastar::app_template instance. Consequently we can
tailor the options registered and the --help content (the application
description) to the command run.
So now "scylla sstable --help" prints only a general description of the
tool and a list of the supported operations. Invoking "scylla sstable
{operation} --help" will print a detailed description of the operation
along with its specific options. This greatly improves the documentation
and the usability of the tool.
"

Refs scylladb#9882

* 'tools-command-oriented-cli/v1' of https://github.com/denesb/scylla:
  tools/scylla-sstable: update general description
  tools/scylla-sstable: proper operation-specific --help
  tools/scylla-sstable: proper operation-specific options
  tools/scylla-sstable: s/dump/dump-data/
  tools/utils: remove now unused get_selected_operation() overload
  tools: take operations (commands) as positional arguments
  tools/utils: add positional-argument based overload of get_selected_operation()
  tools: remove obsolete FIXMEs
  • Loading branch information
avikivity committed Jan 17, 2022
2 parents 518abe7 + 4f4df25 commit 2754e29
Show file tree
Hide file tree
Showing 3 changed files with 349 additions and 190 deletions.
Loading

0 comments on commit 2754e29

Please sign in to comment.