Closed NikolausDemmel closed 10 years ago
@wjwwood please review.
This has become a bit more extensive than anticipated. More stuff to follow soon.
@NikolausDemmel Extensive indeed, I'll do my best to review it tonight.
I'm not sure if this is desired, but I get this when using the --print-config
global option:
% xylem --print-config
usage: xylem [--os name:version] [--os-features "feature1,feature2,..."]
[--core-installers "inst1,inst2,..."]
[--use-additional-installers yes|no]
[--install-from "inst1:[key1,key2,...] ..."]
[--installer-options "inst1:{opt1:val1,...}, ..."]
[--user-sources yes|no] [--cache-dir PATH] [--sources-dir PATH]
[-h] [--version] [-v] [-d] [--print-config] [--no-user-config]
[--prefix XYLEM_PREFIX] [--xylem-dir XYLEM_DIR]
[resolve | lookup | update] ...
xylem: error: too few arguments
When I run xylem resolve
with no arguments, nothing happens, I would expect usage for resolve
:
% xylem resolve
Ok, other than the few small comments this is a +1 from me. Please fixup those things I touched on, merge this, and then rebase the other pull requests.
I'm not sure if this is desired, but I get this when using the
--print-config
global option:
It seems to be a limitation of argparse to not allow optional subparsers. The simplest fix might involve http://stackoverflow.com/a/22054398/1813258.
P.S.: I just stumbled upon http://docopt.org/ (the recorded talk is a nice watch). I seems like a really powerful and simple way to do CLI, but unfortunately it looks to be not as practical when options come from different places.
When I run
xylem resolve
with no arguments, nothing happens
Will fix.
Ok, other than the few small comments this is a +1 from me. Please fixup those things I touched on, merge this, and then rebase the other pull requests.
args
/opts
is pending a decision- for
xylem --print-config
I opened #22
I addressed the other comments as a new commit https://github.com/catkin/xylem/commit/720d3db244c13fbbd1d5595990d8a1e975f4430f ontop of the most recent stuff to avoid rebasing so many commits and possibly manually mergin a bunch of times.
Thanks for the comments.
config_utils
for a general purpose tool to describe config files, parse yaml config files and expose specific arguments to the command line; includes some unit tests for the config item typesconfig
describes xylem's global configuration; includes the logic to compute sources and cache folders given command line arguments and config filesarguments
for global command line arguments (moved fromutils
); interacts with config to include and process global config argumentsyaml_utils
contains customization to loading and dumping yaml (moved (fromutils
)--help
argument now uses pydoc.pager to display the help in aless
-like scrollable manner on pty'sconfig arguments
, describing the arguments that correspond to a config file entrycommands.main
InstallerContext
andSourcesContext
now take a config dictionary as argument, which defaults to the global config singleton if not passed explicitlyupdate
,resolve
,lookup
) is also parameterized by an optional config dict argument, which defaults to the global configOutput of
xylem resolve --help
:Given the following config file in
~/.config/xylem/config.yaml
,the output of two example commands to illustrate the config functionality follows: