Expand description
the status contains information written on the grey line near the bottom of the screen
Fields§
§message: String
§error: bool
Implementations§
source§impl Status
impl Status
sourcepub fn new<S: Into<String>>(message: S, error: bool) -> Status
pub fn new<S: Into<String>>(message: S, error: bool) -> Status
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,
)
}
}
sourcepub fn from_message<S: Into<String>>(message: S) -> Status
pub fn from_message<S: Into<String>>(message: S) -> Status
Examples found in repository?
More examples
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)
}
sourcepub fn from_error<S: Into<String>>(message: S) -> Status
pub fn from_error<S: Into<String>>(message: S) -> Status
Examples found in repository?
More 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()
}