You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/cli.rs
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -91,9 +91,13 @@ pub enum Commands {
91
91
/// Copy an initial rcds.yaml to the current working directory.
92
92
///
93
93
/// If interactive is enabled, then it will prompt for the various fields of the config file. If left disabled, then it will copy it out with fake data of the expected format.
94
+
///
95
+
/// If blank is enabled, then it will copy out the file without any fields set. If left disabled, it will write the default non-interactive example config to file.
println!("For all prompts below, simply press Enter to leave blank.");
83
+
println!("All fields that can be set in rcds.yaml can also be set via environment variables.");
84
+
85
+
let flag_regex = inquire::Text::new("Flag regex:")
48
86
.with_help_message(
49
87
"This regex will be used to validate the individual flags of your challenges later.",
50
-
)
88
+
)// TODO: also provide regex examples for help
51
89
.prompt()?;// yo is this even a good idea to have the user provide the regex
52
-
println!("{flag_regex}");
53
-
Ok(())
90
+
// TODO: with placeholder?
91
+
92
+
let registry_domain = inquire::Text::new("Container registry:")
93
+
.with_help_message("This is the domain of your remote container registry, which includes both the endpoint details and your repository name.")//where you will push images to and where your cluster will pull challenge images from.")
94
+
.prompt()?;
95
+
96
+
let registry_build_user = inquire::Text::new("Container registry user (YOURS):")
97
+
.with_help_message("Your username to the remote container registry, which you will use to push containers to.")
98
+
.prompt()?;
99
+
100
+
// TODO: do we actually want to be in charge of these credentials vs letting the container building utility take care of it?
101
+
let registry_build_pass = inquire::Password::new("Container registry password (YOURS):")
102
+
.with_help_message("Your password to the remote container registry, which you will use to push containers to.")// TODO: could this support username:pat too?
let registry_cluster_user = inquire::Text::new("Container registry user (CLUSTER'S):")
108
+
.with_help_message("The cluster's username to the remote container registry, which it will use to pull containers from.")
109
+
.prompt()?;
110
+
111
+
// TODO: would the cluster not use a token of some sort?
112
+
let registry_cluster_pass = inquire::Password::new("Container registry password (CLUSTER'S):")
113
+
.with_help_message("The cluster's password to the remote container registry, which it will use to pull containers from.")
114
+
.prompt()?;
115
+
116
+
println!("You can define several challenge difficulty classes below:");
117
+
loop{
118
+
// TODO: theres no reason these need to be numbers instead of open strings, e.g. for "easy"
119
+
let difficulty_class_rank = inquire::CustomType::<u64>::new("Difficulty rank:")
120
+
// default parser calls std::u64::from_str
121
+
.with_error_message("Please type a valid number.")
122
+
.with_help_message("The rank of the difficulty class as an unsigned integer, with lower numbers being \"easier.\"")
123
+
.prompt()?;
124
+
125
+
// TODO: support static-point challenges
126
+
let difficulty_class_min = inquire::CustomType::<u64>::new("Minimum number of points:")
127
+
// default parser calls std::u64::from_str
128
+
.with_error_message("Please type a valid number.")
129
+
.with_help_message("Challenge points are dynamic: the maximum number of points that challenges within this difficulty class are worth.")
130
+
.prompt()?;
131
+
132
+
let difficulty_class_max = inquire::CustomType::<u64>::new("Maximum number of points:")
133
+
// default parser calls std::u64::from_str
134
+
.with_error_message("Please type a valid number.")
135
+
.with_help_message("Challenge points are dynamic: the minimum number of points that challenges within this difficulty class are worth.")
136
+
.prompt()?;
137
+
138
+
let points_object = Points{
139
+
difficulty: difficulty_class_rank.to_string(),
140
+
min: difficulty_class_min.to_string(),
141
+
max: difficulty_class_max.to_string(),
142
+
};
143
+
points_difficulty.push(points_object);
144
+
145
+
let again = inquire::Confirm::new("Do you want to provide another difficulty class?")
146
+
.with_default(false)
147
+
.prompt()?;
148
+
if !again {
149
+
break;
150
+
}
151
+
}
152
+
153
+
let defaults_difficulty = inquire::Select::new(
154
+
"Please choose the default difficulty class:",
155
+
points_difficulty.clone(),
156
+
)
157
+
.prompt()?;
158
+
159
+
// TODO: how much format validation should these two do now vs offloading to validate() later? current inquire replacement calls are temporary and do the zero checking, just grabbing a String
160
+
// defaults_resources_cpu = inquire::CustomType::<u64>::new("Default CPUs per challenge:")
161
+
// // default parser calls std::u64::from_str
162
+
// .with_error_message("Please type a valid number.")
163
+
// .with_help_message("The maximum limit of CPU resources per instance of challenge deployment (\"pod\").")
164
+
// .prompt()?;
165
+
let defaults_resources_cpu = inquire::Text::new("Default limit of CPUs per challenge")
166
+
.with_help_message(
167
+
"The maximum limit of CPU resources per instance of challenge deployment (\"pod\").",
0 commit comments