* Jin Yao <yao....@linux.intel.com> wrote:

> +++ b/tools/perf/perf.c
> @@ -64,6 +64,7 @@ static struct cmd_struct commands[] = {
>       { "top",        cmd_top,        0 },
>       { "annotate",   cmd_annotate,   0 },
>       { "version",    cmd_version,    0 },
> +     { "version2",   cmd_version2,   0 },
>       { "script",     cmd_script,     0 },
>       { "sched",      cmd_sched,      0 },
>  #ifdef HAVE_LIBELF_SUPPORT
> @@ -190,6 +191,11 @@ static int handle_options(const char ***argv, int *argc, 
> int *envchanged)
>                       break;
>               }
>  
> +             if (!strcmp(cmd, "-vv")) {
> +                     (*argv)[0] = "--version2";
> +                     break;
> +             }

That is just lazy hackery, please use the regular option library to add options 
and document them!

Also, '--version2' is a sloppy name, the right solution is to do what Git does, 
it 
has a --build-options sub-option to 'perf version':

  triton:~/tip> git version -h
  usage: git version [<options>]

      --build-options       also print build options


  triton:~/tip> git version --build-options
  git version 2.14.1
  sizeof-long: 8

This should be done for perf as well, and _then_ maybe can we add a helper 
alias 
that maps '-vv' to 'version --build-options'.

Thanks,

        Ingo

Reply via email to