1use workflow::{Work, Instruction};
2use workflow::Instruction::Display;
3use config::Context;
4use dto::{Request, Response};
5
6pub fn execute_auto_complete(context: &Context) -> Work {
7 Work::instruction(Display(build_auto_complete(context), Response::Ok))
8}
9
10pub fn build_auto_complete(context: &Context) -> String {
11 context.get_commands().iter().fold(s!(), |a, b| format!("{}{}\n", a, &b.name))
12}
13
14pub fn no_auto_complete(_: Request, _: &Context) -> Work {
15 Work::instruction(Instruction::ExitCode(Response::Ok))
16}