blob: 8318fbe718e96c7fb7aa2901c11f02bb45939f4b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
use comp_system_macros::{file_suggest, suggest};
use just_enough_vcs::system::workspace::workspace::manager::WorkspaceManager;
use rust_i18n::t;
use crate::systems::comp::{context::CompletionContext, result::CompletionResult};
pub fn comp(ctx: CompletionContext) -> CompletionResult {
if ctx.current_word.starts_with('-') {
return suggest!(
"-A" = t!("workspace_sheet.comp.list_all").trim(),
"--list-all" = t!("workspace_sheet.comp.list_all").trim(),
"-p" = t!("workspace_sheet.comp.print_path").trim(),
"--print-path" = t!("workspace.sheet.comp.print_path").trim(),
"-n" = t!("workspace_sheet.comp.new").trim(),
"--new" = t!("workspace_sheet.comp.new").trim(),
"-d" = t!("workspace_sheet.comp.delete").trim(),
"--delete" = t!("workspace_sheet.comp.delete").trim()
)
.into();
}
if ctx.previous_word == "--new" || ctx.previous_word == "-n" {
return suggest!().into();
}
if ctx.previous_word == "--list-all"
|| ctx.previous_word == "-A"
|| ctx.previous_word == "--print-path"
|| ctx.previous_word == "-p"
|| ctx.previous_word == "--delete"
|| ctx.previous_word == "-d"
{
let rt = tokio::runtime::Runtime::new().unwrap();
let names = rt.block_on(WorkspaceManager::new().list_sheet_names());
return names.into();
}
file_suggest!()
}
|