--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: per-subcommand config file sections
- From: Enrico Zini <enrico@debian.org>
- Date: Mon, 11 Jun 2012 20:37:59 +0200
- Message-id: <20120611183759.19819.13720.reportbug@viaza.enricozini.org>
Package: python-cliapp
Version: 0.29-1
Severity: wishlist
Hello,
I'm hitting a limit in the default "command line options in config file"
behaviour: I have a "--output" option that sends the command output to a
file instead of stdout.
I'd like to set a config file option to avoid typing this command:
egt backup --output="/var/backups/egt-%Y-%m-%d-%H:%M:%S.tar"
but I still want this command to send output to stdout:
egt weekly-report
A possible implementation would be allowing a per-subcommand section in
the config file, like this:
[cmd backup]
output = "/var/backups/egt-%Y-%m-%d-%H:%M:%S.tar"
the section being ignored unless the given subcommand is being run.
I didn't suggest to just use [backup] for the section name, because
that would be ambiguous if one implemented a 'config' subcommand.
However, 'cmd ' looks rather ugly, and just the subcommand name would
feel much more natural. An alternative, backwards-compatible strategy
could be to also accept something like "[DEFAULTS]" for the main
section, and if the main section is named that way then 'config' is not
treated specially and can be used for subcommands.
Unfortunately ConfigParser won't parse a config file with data outside
of any section header: that would have been a perfect solution to the
ambiguity.
However, it does accept "[ ]" (must have a space) as a section header.
It's another option, but still not so natural.
Ciao,
Enrico
-- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages python-cliapp depends on:
ii python 2.7.2-10
ii python2.6 2.6.7-4
ii python2.7 2.7.3~rc2-2.1
python-cliapp recommends no packages.
Versions of packages python-cliapp suggests:
ii libjs-query <none>
ii libjs-underscore 1.1.6-1
-- no debconf information
--- End Message ---