summaryrefslogtreecommitdiff
path: root/src/cmds/comp/sheetedit.rs
blob: 1ebf63de62e86d7cfa75415cf3aef32b2f3539f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use comp_system_macros::{file_suggest, suggest};
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!(
            "-e" = t!("sheetedit.comp.editor").trim(),
            "--editor" = t!("sheetedit.comp.editor").trim(),
        )
        .into();
    }

    if ctx.previous_word == "-e" || ctx.previous_word == "--editor" {
        return suggest!().into();
    }

    file_suggest!()
}