Messages in this thread | | | Date | Sun, 19 Apr 2015 12:34:48 +0900 | From | Namhyung Kim <> | Subject | Re: [PATCH 1/2] perf tools: Add 'perf-config' command |
| |
On Sat, Apr 18, 2015 at 07:14:06PM +0900, Taewoong Song wrote: > > On Apr 13, 2015, at 3:16 PM, Namhyung Kim <namhyung@kernel.org> wrote: > > On Sun, Apr 12, 2015 at 11:44:48PM +0900, Taeung Song wrote: > >> +static void check_argc(int argc, int limit) > >> +{ > >> + if (argc >= limit && argc <= limit) > >> + return; > >> + error("wrong number of arguments"); > >> + usage_with_options(config_usage, config_options); > >> +} > > > > I don't know why this is needed. The -a option won't need this and we > > can support to get/set any number of config items IMHO. > > > > I also think we can support to get/set any number of config items. > But I think that ‘—list’ or ‘—all’ can need to be checked to validate argument. > If work ‘git —list’ with other argument, error message can be printed like this. > > :> git config --list 134 > error: wrong number of arguments > usage: git config [options] > > Config file location > --global use global config file > --system use system config file > --local use repository config file > -f, --file <file> use given config file > --blob <blob-id> read config from given blob object > > …(omitted)… > > If don’t checking number of argument, we allow users to work a optio > ‘-a’ or ‘-l’ with other arguments which can be weor meaningless. > Did I misunderstand what you say? > Or is there other way to avoid this problem ?
Then just check 'argc != 0' for -l or -a cases. The get/set won't need it IMHO.
Thanks, Namhyung
| |