linux/tools/lib/subcmd
Namhyung Kim ea558c8624 tools lib subcmd: Show parent options in help
I've just realized that help message in a subcommand didn't show one
in the parent command.  Since the option parser understands the parent,
display code should do the same.  For example, `perf ftrace latency -h`
should show options in the `perf ftrace` command too.

Before:

  $ perf ftrace latency -h

   Usage: perf ftrace [<options>] [<command>]
      or: perf ftrace [<options>] -- [<command>] [<options>]
      or: perf ftrace {trace|latency} [<options>] [<command>]
      or: perf ftrace {trace|latency} [<options>] -- [<command>] [<options>]

      -b, --use-bpf         Use BPF to measure function latency
      -n, --use-nsec        Use nano-second histogram
      -T, --trace-funcs <func>
                            Show latency of given function

After:

  $ perf ftrace latency -h

   Usage: perf ftrace [<options>] [<command>]
      or: perf ftrace [<options>] -- [<command>] [<options>]
      or: perf ftrace {trace|latency} [<options>] [<command>]
      or: perf ftrace {trace|latency} [<options>] -- [<command>] [<options>]

      -a, --all-cpus        System-wide collection from all CPUs
      -b, --use-bpf         Use BPF to measure function latency
      -C, --cpu <cpu>       List of cpus to monitor
      -n, --use-nsec        Use nano-second histogram
      -p, --pid <pid>       Trace on existing process id
      -T, --trace-funcs <func>
                            Show latency of given function
      -v, --verbose         Be more verbose
          --tid <tid>       Trace on existing thread id (exclusive to --pid)

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240429233707.1511175-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2024-05-12 21:09:52 -03:00
..
Build
exec-cmd.c libsubcmd: Avoid two path statics, removing 8192 bytes from .bss 2023-05-28 10:25:55 -03:00
exec-cmd.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
help.c libsubcmd: Fix memory leak in uniq() 2024-01-04 18:29:17 -03:00
help.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile tools lib subcmd: Add dependency test to install_headers 2022-12-14 11:16:12 -03:00
pager.c tools lib subcmd: Support overwriting the pager 2018-09-19 15:16:19 -03:00
pager.h tools lib subcmd: Support overwriting the pager 2018-09-19 15:16:19 -03:00
parse-options.c tools lib subcmd: Show parent options in help 2024-05-12 21:09:52 -03:00
parse-options.h tools/lib/subcmd: Replace NORETURN usage with __noreturn 2023-05-16 06:31:54 -07:00
run-command.c tools subcmd: Add check_if_command_finished() 2024-04-08 17:43:20 -03:00
run-command.h tools subcmd: Add check_if_command_finished() 2024-04-08 17:43:20 -03:00
sigchain.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sigchain.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
subcmd-config.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
subcmd-config.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
subcmd-util.h tools/lib/subcmd: Replace NORETURN usage with __noreturn 2023-05-16 06:31:54 -07:00