pub fn on_path(
    path: PathBuf,
    tree: &mut Tree,
    screen: Screen,
    in_new_panel: bool
) -> CmdResult
Examples found in repository?
src/verb/internal_select.rs (line 48)
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
pub fn on_internal(
    internal_exec: &InternalExecution,
    input_invocation: Option<&VerbInvocation>,
    trigger_type: TriggerType,
    tree: &mut Tree,
    app_state: & AppState,
    cc: &CmdContext,
) -> CmdResult {
    let screen = cc.app.screen;
    info!(
        "internal_select.on_internal internal_exec={:?} input_invocation={:?} trygger_type={:?}",
        internal_exec,
        input_invocation,
        trigger_type,
    );
    let bang = input_invocation
            .map(|inv| inv.bang)
            .unwrap_or(internal_exec.bang);
    let input_arg = input_invocation.as_ref()
        .and_then(|invocation| invocation.args.as_ref());
    match trigger_type {
        TriggerType::Input(verb) => {
            let path = path_from_input(
                verb,
                internal_exec,
                &tree.selected_line().path,
                input_arg,
                app_state,
            );
            on_path(path, tree, screen, bang)
        }
        _ => {
            // the :select internal was triggered by a key
            if let Some(arg) = &internal_exec.arg {
                // the internal_execution specifies the path to use
                // (it may come from a configured verb whose execution is
                //  `:select some/path`).
                // The given path may be relative hence the need for the
                // state's selection
                let path = path::path_from(
                    &tree.selected_line().path,
                    PathAnchor::Unspecified,
                    arg,
                );
                let bang = input_invocation
                    .map(|inv| inv.bang)
                    .unwrap_or(internal_exec.bang);
                on_path(path, tree, screen, bang)
            } else {
                // there's nothing really to do here
                CmdResult::Keep
            }
        }
    }
}