From e94905a895bd76b516fad893a8a056f1d7f7dd37 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 22 Feb 2011 08:18:09 +0000 Subject: [PATCH] add command completion to "debug" git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1889 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 2 ++ urjtag/src/cmd/cmd_debug.c | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 592703a7..299d7d53 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -2,6 +2,8 @@ * src/cmd/cmd_print.c: Add a completion handler. + * src/cmd/cmd_debug.c: Add a completion handler. + 2011-02-21 Mike Frysinger * data/Makefile.am (nobase_dist_pkgdata_DATA): Add missing analog/bfin/bfin. diff --git a/urjtag/src/cmd/cmd_debug.c b/urjtag/src/cmd/cmd_debug.c index 8a37e6e2..bffb655a 100644 --- a/urjtag/src/cmd/cmd_debug.c +++ b/urjtag/src/cmd/cmd_debug.c @@ -131,9 +131,27 @@ cmd_debug_help (void) "debug"); } +static void +cmd_debug_complete (urj_chain_t *chain, char ***matches, size_t *match_cnt, + const char *text, size_t text_len, size_t token_point) +{ + if (token_point != 1) + return; + + urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "all"); + urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "comm"); + urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "debug"); + urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "detail"); + urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "normal"); + urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "warning"); + urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "error"); + urj_completion_mayben_add_match (matches, match_cnt, text, text_len, "silent"); +} + const urj_cmd_t urj_cmd_debug = { "debug", N_("set logging/debugging level"), cmd_debug_help, - cmd_debug_run + cmd_debug_run, + cmd_debug_complete, };