1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
74
75
76
77
78
79
80
81
82
83
84
85
macro_rules! command_group_config {

    ($(#[doc=$doc:literal] $group:ident),*) => {

        /// Enables or disables certain command groups
        #[derive(Clone, Debug, Default)]
        pub struct CommandGroupConfig {
            $(pub(crate) $group: bool,)*
        }

        impl CommandGroupConfig {
            /// Enables all commands
            pub fn all_groups(mut self, enabled: bool) -> Self {
                $(
                    self.$group = enabled;
                )*

                self
            }

            $(
            paste::item! {
                #[doc=$doc]
                #[inline]
                pub fn [< $group _group>](mut self, enabled: bool) -> Self {
                    self.$group = enabled;

                    self
                }
            }
            )*
        }
    }
}

command_group_config!(
    /// Enables core commands
    core,
    /// Enables debug commands
    debug,
    /// Enables filter commands
    filter,
    /// Enables chart commands
    chart,
    /// Enables misc commands
    misc,
    /// Enables commands that allow path manipulation
    path,
    /// Enables system commands
    system,
    /// Enables commands to manipulate strings
    string,
    /// Enables commands to manipulate bits
    bit,
    /// Enables commands to manipulate bytes
    byte,
    /// Enables commands that allow file system operations
    file_system,
    /// Enables commands that allow using shell features like ansi colors
    platform,
    /// Enables commands that allow datetime manipulation
    date,
    /// Enables commands that allow creating and switching between nu shell instances
    shell,
    /// Enables commands that allow parsing from one data format to another
    format,
    /// Enables commands that allow displaying data in certain viewers like a table or grid
    viewer,
    /// Enables commands that allow converting from one data format to another
    conversion,
    /// Enables commands that allow manipulating environment variables
    environment,
    /// Enables math related commands
    math,
    /// Enables commands that allow networking
    network,
    /// Enables commands that generate random values
    random,
    /// Enables commands that generate values for a given input
    generator,
    /// Enables commands that work with hash sums
    hash,
    /// Enables commands that are still experimental like `is-admin` and `view-source`
    experimental
);