* Markus Armbruster (arm...@redhat.com) wrote: > "Dr. David Alan Gilbert (git)" <dgilb...@redhat.com> writes: > > > From: "Dr. David Alan Gilbert" <dgilb...@redhat.com> > > > > Don't show the commands that aren't available. > > > > Signed-off-by: Dr. David Alan Gilbert <dgilb...@redhat.com> > > Reviewed-by: Peter Xu <pet...@redhat.com> > > Reviewed-by: Igor Mammedov <imamm...@redhat.com> > > --- > > monitor.c | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/monitor.c b/monitor.c > > index 31c8f5dc88..c369b392db 100644 > > --- a/monitor.c > > +++ b/monitor.c > > @@ -3951,12 +3951,17 @@ static void > > monitor_find_completion_by_table(Monitor *mon, > > cmdname = args[0]; > > readline_set_completion_index(mon->rs, strlen(cmdname)); > > for (cmd = cmd_table; cmd->name != NULL; cmd++) { > > - cmd_completion(mon, cmdname, cmd->name); > > + if (!runstate_check(RUN_STATE_PRECONFIG) || > > + cmd_can_preconfig(cmd)) { > > + cmd_completion(mon, cmdname, cmd->name); > > + } > > } > > } else { > > /* find the command */ > > for (cmd = cmd_table; cmd->name != NULL; cmd++) { > > - if (compare_cmd(args[0], cmd->name)) { > > + if (compare_cmd(args[0], cmd->name) && > > + (!runstate_check(RUN_STATE_PRECONFIG) || > > + cmd_can_preconfig(cmd))) { > > break; > > } > > } > > Hmm, I keep seeing > > !runstate_check(RUN_STATE_PRECONFIG) || cmd_can_preconfig(cmd) > > Would a helper be worthwhile? cmd_available(cmd)?
Yes, but I want to leave that change until I add the next flag (for OOB some time) so I know how to generalise it; I'm not sure what it'll need yet. Dave -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK