Skip to content

Commit 502959a

Browse files
authored
Massively simplify multi-config! (#206)
It should run gg things not not gg things!
1 parent 6de796a commit 502959a

File tree

1 file changed

+8
-53
lines changed

1 file changed

+8
-53
lines changed

src/stage4/src/main.rs

Lines changed: 8 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -259,59 +259,14 @@ async fn main() -> ExitCode {
259259
continue;
260260
}
261261

262-
let execute_as_gg_command = |args: &[String]| {
263-
let mut gg_args = vec![env::args().next().unwrap_or_else(|| {
264-
env::current_exe().unwrap().to_string_lossy().to_string()
265-
})];
266-
gg_args.extend(args.iter().map(|s| s.to_string()));
267-
std::process::Command::new(&gg_args[0])
268-
.args(&gg_args[1..])
269-
.status()
270-
};
271-
272-
let status = if command_args.len() == 1 {
273-
if let Some(nested_alias_commands) =
274-
config.resolve_alias_with_and(&command_args[0])
275-
{
276-
let mut all_success = true;
277-
for nested_command_args in nested_alias_commands {
278-
if nested_command_args.is_empty() {
279-
continue;
280-
}
281-
let nested_status =
282-
std::process::Command::new(&nested_command_args[0])
283-
.args(&nested_command_args[1..])
284-
.status();
285-
match nested_status {
286-
Ok(exit_status) => {
287-
if !exit_status.success() {
288-
all_success = false;
289-
break;
290-
}
291-
}
292-
Err(_) => {
293-
all_success = false;
294-
break;
295-
}
296-
}
297-
}
298-
if all_success {
299-
std::process::Command::new("true").status()
300-
} else {
301-
std::process::Command::new("false").status()
302-
}
303-
} else if let Some(nested_alias_args) =
304-
config.resolve_alias(&command_args[0])
305-
{
306-
execute_as_gg_command(&nested_alias_args)
307-
} else {
308-
execute_as_gg_command(&command_args)
309-
}
310-
} else {
311-
std::process::Command::new(&command_args[0])
312-
.args(&command_args[1..])
313-
.status()
314-
};
262+
let mut gg_args = vec![env::args().next().unwrap_or_else(|| {
263+
env::current_exe().unwrap().to_string_lossy().to_string()
264+
})];
265+
gg_args.extend(command_args.iter().map(|s| s.to_string()));
266+
267+
let status = std::process::Command::new(&gg_args[0])
268+
.args(&gg_args[1..])
269+
.status();
315270

316271
match status {
317272
Ok(exit_status) => {

0 commit comments

Comments
 (0)