tools lib subcmd: Suppport cascading options
authorNamhyung Kim <namhyung@kernel.org>
Mon, 24 Oct 2016 03:00:02 +0000 (12:00 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 25 Oct 2016 13:12:16 +0000 (10:12 -0300)
commit369a2478973a416a2c42a37a8cf7031872a6d926
tree2f59cd5560b246452d6702e8caefc162c4235a69
parent8a06b0be6507f97f3aa92ca814335b8b65fd3de2
tools lib subcmd: Suppport cascading options

Sometimes subcommand have common options and it can only handled in the
upper level command unless it duplicates the options.

This patch adds a parent field and fallback to the parent if the given
argument was not found in the current options.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20161024030003.28534-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/subcmd/parse-options.c
tools/lib/subcmd/parse-options.h