From 03ac12e292a87fb097cce92d365627efefc2ac8e Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 1 Jul 2011 00:44:33 +0000 Subject: [PATCH] initbus: add support for completing bus parameters git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1942 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 4 ++++ urjtag/src/cmd/cmd_initbus.c | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index d7ace6e7..8549864a 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,3 +1,7 @@ +2011-06-30 Mike Frysinger + + * cmd/cmd_initbus.c (cmd_initbus_complete): Complete bus parameters too. + 2011-06-30 Jie Zhang * src/cmd/Makefile.am (generated_cmd_list.h): Depend on diff --git a/urjtag/src/cmd/cmd_initbus.c b/urjtag/src/cmd/cmd_initbus.c index d7d405ee..1219852e 100644 --- a/urjtag/src/cmd/cmd_initbus.c +++ b/urjtag/src/cmd/cmd_initbus.c @@ -72,12 +72,19 @@ cmd_initbus_complete (urj_chain_t *chain, char ***matches, size_t *match_cnt, { size_t i; - if (token_point != 1) - return; - - for (i = 0; urj_bus_drivers[i]; i++) - urj_completion_mayben_add_match (matches, match_cnt, text, text_len, - urj_bus_drivers[i]->name); + switch (token_point) + { + case 1: + for (i = 0; urj_bus_drivers[i]; ++i) + urj_completion_mayben_add_match (matches, match_cnt, text, text_len, + urj_bus_drivers[i]->name); + break; + default: + for (i = 0; i < urj_bus_param_list.n; ++i) + urj_completion_mayben_add_match (matches, match_cnt, text, text_len, + urj_bus_param_list.list[i].string); + break; + } } const urj_cmd_t urj_cmd_initbus = {