On Sat, Apr 18, 2015 at 07:14:06PM +0900, Taewoong Song wrote:
> > On Apr 13, 2015, at 3:16 PM, Namhyung Kim <[email protected]> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to