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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#![allow(dead_code)]
use clap::{Parser, Subcommand};
use piglog::LogMode;
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(propagate_version = true)]
/// Make any Linux distribution repeatable!
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
/// Run a generation system command
Gen {
#[command(subcommand)]
command: GenCommands,
},
/// Run the program setup
Setup,
/// Create a default Rebos configuration
InitConfig,
/// API for things like scripting
API {
#[command(subcommand)]
command: APICommands,
},
}
#[derive(Subcommand, Debug)]
pub enum APICommands {
/// Use the Rebos log message system
Echo {
log_mode: LogMode,
message: String,
},
/// Use the Rebos log message system (Generic)
EchoGeneric {
message: String,
},
}
#[derive(Subcommand, Debug)]
pub enum GenCommands {
/// Confirm your custom generation, and make it the 'current' generation
Commit(Commit),
/// List all system generations
List,
/// Delete duplicate generations
CleanDups,
/// Align all generation numbers (Example: [1, 4, 22, 35] -> [1, 2, 3, 4])
Align,
/// Automatically clean up the generations (clean-dups, align, etc...)
TidyUp,
/// Get information on the generation in the user's config
Info,
/// Print out what the latest system generation number is
Latest,
/// Delete older generations
DeleteOld(GenDeleteOld),
/// Delete a specific generation
Delete(GenDelete),
/// The difference between 2 generations
Diff {
/// Generation to act as base
old: usize,
/// Generation to act as changes
new: usize,
},
/// Command related to the 'current' generation
Current {
#[command(subcommand)]
command: CurrentCommands,
},
}
#[derive(Subcommand, Debug)]
pub enum CurrentCommands {
/// Build the 'current' generation (You can always roll back later)
Build,
/// Rollback to a previous generation (You still need to build after rolling back)
Rollback(Rollback),
/// Set the 'current' generation to the latest generation
ToLatest,
/// Set the 'current' generation to a specific generation
Set(SetCurrent),
}
#[derive(Parser, Debug)]
pub struct GenDelete {
/// The generation to delete
pub generation: usize,
}
#[derive(Parser, Debug)]
pub struct GenDeleteOld {
/// Starting at the oldest generation, how many should be deleted?
pub how_many: usize,
}
#[derive(Parser, Debug)]
pub struct Commit {
/// The commit message shows up in the list command
pub msg: String,
}
#[derive(Parser, Debug)]
pub struct SetCurrent {
/// Generation to jump to
pub to: usize,
}
#[derive(Parser, Debug)]
pub struct Rollback {
/// How many generations to rollback by
pub by: isize,
}