diff mbox series

[3/3] trace-cmd: bash completion of "trace-cmd dump" sub-command

Message ID 20200109122055.286290-4-tz.stoyanov@gmail.com (mailing list archive)
State Accepted
Headers show
Series Add new trace-cmd sub-command "dump" | expand

Commit Message

Tzvetomir Stoyanov (VMware) Jan. 9, 2020, 12:20 p.m. UTC
Update trace-cmd bash completion logic to support "trace-cmd dump" sub-command

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 tracecmd/trace-cmd.bash | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
diff mbox series

Patch

diff --git a/tracecmd/trace-cmd.bash b/tracecmd/trace-cmd.bash
index bdc1410..85f6743 100644
--- a/tracecmd/trace-cmd.bash
+++ b/tracecmd/trace-cmd.bash
@@ -183,6 +183,23 @@  __trace_cmd_report_complete()
     esac
 }
 
+__trace_cmd_dump_complete()
+{
+    local prev=$1
+    local cur=$2
+    shift 2
+    local words=("$@")
+
+    case "$prev" in
+	-i)
+	    __show_files
+	    ;;
+	*)
+	    cmd_options dump "$cur"
+	    ;;
+    esac
+}
+
 __show_command_options()
 {
     local command="$1"
@@ -246,6 +263,10 @@  _trace_cmd_complete()
 	    __trace_cmd_report_complete "${prev}" "${cur}" ${words[@]}
 	    return 0
 	    ;;
+	dump)
+	    __trace_cmd_dump_complete "${prev}" "${cur}" ${words[@]}
+	    return 0
+	    ;;
         *)
 	    __show_command_options "$w" "${cur}"
             ;;