broot/verb/verb_execution.rs
1use {
2 super::*,
3 std::fmt,
4};
5
6/// how a verb must be executed
7#[derive(Debug, Clone)]
8pub enum VerbExecution {
9 /// the verb execution is based on a behavior defined in code in Broot.
10 /// Executions in conf starting with ":" are of this type.
11 Internal(InternalExecution),
12
13 /// the verb execution refers to a command that will be executed by the system,
14 /// outside of broot.
15 External(ExternalExecution),
16
17 /// the execution is a sequence similar to what can be given
18 /// to broot with --cmd
19 Sequence(SequenceExecution),
20}
21
22// This implementation builds a string used for description (eg in help)
23impl fmt::Display for VerbExecution {
24 fn fmt(
25 &self,
26 f: &mut fmt::Formatter<'_>,
27 ) -> fmt::Result {
28 match self {
29 Self::Internal(ie) => ie.fmt(f),
30 Self::External(ee) => ee.exec_pattern.fmt(f),
31 Self::Sequence(se) => se.sequence.raw.fmt(f),
32 }
33 }
34}