-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve options and arguments parsing. (#100)
* Improve options and arguments parsing. Our nested command and sub-commands parsing is not compatible with the default GNU getopt behavior where they will re-order the command line so that users are free to mix options and arguments as they want. When we are on the final sub-command though, we could re-enable the default behavior of GNU getopt_long for more flexibility to the user. That's what we do with this patch, making it possible to use either form for the same command as in the following example: $ pg_autoctl -q config get --pgdata /tmp/sm/a postgresql.port 3001 $ pg_autoctl -q config get postgresql.port --pgdata /tmp/sm/a 3001 Without this patch, only the first case works. As most of our commands only process options, only two places need to be adjusted to make that behavior available. The other commands don't need this at the moment. * Implement --version, --verbose, and --quiet on every final subcommand. That way users don't have to remember to use those options only after the main program name and before any subcommand, it just works everywhere (or almost) in the command line: pg_autoctl -q config get --pgdata /tmp/sm/a postgresql.port pg_autoctl config get --pgdata /tmp/sm/a postgresql.port -q That's now implemented for all our commands. * Fix --help options in all commands. This require changing the --pghost short option letter to -H, but as it's not documented anyway, it should be ok for us to reclaim -h for --help.
- Loading branch information
Showing
13 changed files
with
611 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.