Tab completion for help
This commit is contained in:
parent
6fb9b4c2d3
commit
376fa1d1d1
@ -2,16 +2,19 @@ use crate::repl::command_tree::CommandTree;
|
|||||||
use crate::repl::directive_actions::DirectiveAction;
|
use crate::repl::directive_actions::DirectiveAction;
|
||||||
|
|
||||||
pub fn directives_from_pass_names(pass_names: &Vec<String>) -> CommandTree {
|
pub fn directives_from_pass_names(pass_names: &Vec<String>) -> CommandTree {
|
||||||
use DirectiveAction::*;
|
|
||||||
|
|
||||||
let passes_directives: Vec<CommandTree> = pass_names.iter()
|
let passes_directives: Vec<CommandTree> = pass_names.iter()
|
||||||
.map(|pass_name| { CommandTree::nonterm_no_further_tab_completions(pass_name, None) })
|
.map(|pass_name| { CommandTree::nonterm_no_further_tab_completions(pass_name, None) })
|
||||||
.collect();
|
.collect();
|
||||||
|
CommandTree::Top(get_list(&passes_directives, true))
|
||||||
|
}
|
||||||
|
|
||||||
CommandTree::Top(vec![
|
fn get_list(passes_directives: &Vec<CommandTree>, include_help: bool) -> Vec<CommandTree> {
|
||||||
|
use DirectiveAction::*;
|
||||||
|
|
||||||
|
vec![
|
||||||
CommandTree::terminal("exit", Some("exit the REPL"), vec![], QuitProgram),
|
CommandTree::terminal("exit", Some("exit the REPL"), vec![], QuitProgram),
|
||||||
CommandTree::terminal("quit", Some("exit the REPL"), vec![], QuitProgram),
|
CommandTree::terminal("quit", Some("exit the REPL"), vec![], QuitProgram),
|
||||||
CommandTree::terminal("help", Some("Print this help message"), vec![], Help),
|
CommandTree::terminal("help", Some("Print this help message"), if include_help { get_list(passes_directives, false) } else { vec![] }, Help),
|
||||||
CommandTree::nonterm("debug",
|
CommandTree::nonterm("debug",
|
||||||
Some("Configure debug information"),
|
Some("Configure debug information"),
|
||||||
vec![
|
vec![
|
||||||
@ -38,6 +41,5 @@ pub fn directives_from_pass_names(pass_names: &Vec<String>) -> CommandTree {
|
|||||||
]
|
]
|
||||||
),
|
),
|
||||||
CommandTree::terminal("doc", Some("Get language-specific help for an item"), vec![], Doc),
|
CommandTree::terminal("doc", Some("Get language-specific help for an item"), vec![], Doc),
|
||||||
])
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user