[][src]Function cmdtree::completion::create_action_completion_items

pub fn create_action_completion_items<R>(
    cmdr: &Commander<R>
) -> Vec<ActionMatch>

Constructs a set of space delimited actions that could be completed at the current path.

Examples


let mut cmder = Builder::default_config("eg")
	.begin_class("one", "") // a class
		.begin_class("two", "")
		.add_action("three", "", |_, _| ())
		.end_class()
	.end_class()
	.begin_class("hello", "").end_class()
	.into_commander().unwrap();

let v = create_action_completion_items(&cmder);
assert_eq!(v, vec![ ActionMatch {
		match_str: "one two three ".to_string(),
		qualified_path: "one.two..three".to_string(),
	}]);

cmder.parse_line("one", true, &mut std::io::sink());

let v = create_action_completion_items(&cmder);
assert_eq!(v, vec![ ActionMatch {
		match_str: "two three ".to_string(),
		qualified_path: "one.two..three".to_string(),
	}]);