Struct broot::app::Status

source ·
pub struct Status {
    pub message: String,
    pub error: bool,
}
Expand description

the status contains information written on the grey line near the bottom of the screen

Fields§

§message: String§error: bool

Implementations§

Examples found in repository?
src/app/panel_state.rs (lines 939-942)
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
    fn get_status(
        &self,
        app_state: &AppState,
        cc: &CmdContext,
        has_previous_state: bool,
    ) -> Status {
        match &cc.cmd {
            Command::PatternEdit { .. } => self.no_verb_status(has_previous_state, cc.app.con),
            Command::VerbEdit(invocation) => {
                if invocation.name.is_empty() {
                    Status::new(
                        "Type a verb then *enter* to execute it (*?* for the list of verbs)",
                        false,
                    )
                } else {
                    let sel_info = self.sel_info(app_state);
                    match cc.app.con.verb_store.search_sel_info(
                        &invocation.name,
                        sel_info,
                    ) {
                        PrefixSearchResult::NoMatch => {
                            Status::new("No matching verb (*?* for the list of verbs)", true)
                        }
                        PrefixSearchResult::Match(_, verb) => {
                            self.get_verb_status(verb, invocation, sel_info, cc, app_state)
                        }
                        PrefixSearchResult::Matches(completions) => Status::new(
                            format!(
                                "Possible verbs: {}",
                                completions
                                    .iter()
                                    .map(|c| format!("*{}*", c))
                                    .collect::<Vec<String>>()
                                    .join(", "),
                            ),
                            false,
                        ),
                    }
                }
            }
            _ => self.no_verb_status(has_previous_state, cc.app.con),
        }
    }

    fn get_verb_status(
        &self,
        verb: &Verb,
        invocation: &VerbInvocation,
        sel_info: SelInfo<'_>,
        _cc: &CmdContext,
        app_state: &AppState,
    ) -> Status {
        if sel_info.count_paths() > 1 {
            if let VerbExecution::External(external) = &verb.execution {
                if external.exec_mode != ExternalExecutionMode::StayInBroot {
                    return Status::new(
                        "only verbs returning to broot on end can be executed on a multi-selection".to_owned(),
                        true,
                    );
                }
            }
            // right now there's no check for sequences but they're inherently dangereous
        }
        if let Some(err) = verb.check_args(sel_info, invocation, &app_state.other_panel_path) {
            Status::new(err, true)
        } else {
            Status::new(
                verb.get_status_markdown(
                    sel_info,
                    app_state,
                    invocation,
                ),
                false,
            )
        }
    }
Examples found in repository?
src/app/panel.rs (line 61)
60
61
62
    pub fn set_message<S: Into<String>>(&mut self, md: S) {
        self.status = Status::from_message(md.into());
    }
More examples
Hide additional examples
src/app/panel_state.rs (lines 924-926)
919
920
921
922
923
924
925
926
927
    fn no_verb_status(
        &self,
        _has_previous_state: bool,
        _con: &AppContext,
    ) -> Status {
        Status::from_message(
            "Hit *esc* to get back, or a space to start a verb"
        )
    }
src/app/standard_status.rs (line 118)
106
107
108
109
110
111
112
113
114
115
116
117
118
119
    fn to_status(&self) -> Status {
        let mut md = String::new();
        for (i, p) in self.md_parts.iter().enumerate() {
            md.push_str(if i == 0 {
                "Hit "
            } else if i == self.md_parts.len() - 1 {
                ", or "
            } else {
                ", "
            });
            md.push_str(p);
        }
        Status::from_message(md)
    }
Examples found in repository?
src/app/panel.rs (line 58)
57
58
59
    pub fn set_error(&mut self, text: String) {
        self.status = Status::from_error(text);
    }
More examples
Hide additional examples
src/browser/browser_state.rs (line 628)
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
    fn no_verb_status(
        &self,
        has_previous_state: bool,
        con: &AppContext,
    ) -> Status {
        let tree = self.displayed_tree();
        if tree.is_empty() {
            if tree.build_report.hidden_count > 0 {
                let mut parts = Vec::new();
                if let Some(md) = con.standard_status.all_files_hidden.clone() {
                    parts.push(md);
                }
                if let Some(md) = con.standard_status.all_files_git_ignored.clone() {
                    parts.push(md);
                }
                if !parts.is_empty() {
                    return Status::from_error(parts.join(". "));
                }
            }
        }
        let mut ssb = con.standard_status.builder(
            PanelStateType::Tree,
            tree.selected_line().as_selection(),
        );
        ssb.has_previous_state = has_previous_state;
        ssb.is_filtered = self.filtered_tree.is_some();
        ssb.has_removed_pattern = false;
        ssb.on_tree_root = tree.selection == 0;
        ssb.status()
    }

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.