1use model::{Command, Dependency, DependencyType, Internal, Section};
2
3pub mod edit;
4pub mod editconfig;
5pub mod help;
6pub mod init;
7pub mod node;
8pub mod shell;
9pub mod util;
10pub mod view;
11
12#[cfg(test)]
13mod help_test;
14#[cfg(test)]
15mod shell_test;
16
17pub fn edit_command() -> Command {
18 Command {
19 value: None,
20 internal: Internal {
21 execute: edit::execute,
22 auto_complete: edit::auto_complete,
23 },
24 description: s!("Edit a command"),
25 alias: Some(s!("e")),
26 usage: Some(s!("<command>")),
27 name: s!("edit"),
28 min_args: Some(1),
29 dependencies: Some(vec![
30 Dependency {
31 value: DependencyType::Envar(s!("EDITOR")),
32 description: s!("Set this environment variable to the editor of your choice"),
33 }]),
34 }
35}
36
37pub fn help_command() -> Command {
38 Command {
39 value: None,
40 internal: Internal {
41 execute: help::execute,
42 auto_complete: help::auto_complete,
43 },
44 description: s!("Show help for all commands or a specific command"),
45 alias: Some(s!("h")),
46 usage: Some(s!("[command]")),
47 name: s!("help"),
48 dependencies: None,
49 min_args: None,
50 }
51}
52
53pub fn view_command() -> Command {
54 Command {
55 value: None,
56 internal: Internal {
57 execute: view::execute,
58 auto_complete: view::auto_complete,
59 },
60 description: s!("View a command"),
61 alias: Some(s!("v")),
62 usage: None,
63 name: s!("view"),
64 min_args: None,
65 dependencies: None,
66 }
67}
68
69pub fn edit_config_command() -> Command {
70 Command {
71 value: None,
72 internal: Internal {
73 execute: editconfig::execute,
74 auto_complete: util::no_auto_complete,
75 },
76 description: s!("Edit configuration file"),
77 alias: Some(s!("c")),
78 usage: None,
79 name: s!("config"),
80 min_args: None,
81 dependencies: Some(vec![
82 Dependency {
83 value: DependencyType::Envar(s!("EDITOR")),
84 description: s!("Set this environment variable to the editor of your choice"),
85 }]),
86 }
87}
88
89pub fn get_management_commands() -> Section {
90 Section {
91 heading: s!("Management"),
92 commands: vec![help_command(), edit_command(), view_command(), edit_config_command()],
93 core: true
94 }
95}