Skip to content

Commit bbcc21b

Browse files
committed
reinstall: Cleaner formatting of podman bootc install message
This makes it easier to copy/paste (and read) the `podman ... bootc install ...` command from the CLI output. Signed-off-by: ckyrouac <ckyrouac@redhat.com>
1 parent 578063b commit bbcc21b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

system-reinstall-bootc/src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ fn run() -> Result<()> {
4444
podman::reinstall_command(&config.bootc_image, ssh_key_file_path);
4545

4646
println!();
47-
println!("Going to run command {:?}", reinstall_podman_command);
47+
println!("Going to run command:");
48+
println!();
49+
println!("{}", podman::print_command(&reinstall_podman_command));
4850

4951
prompt::temporary_developer_protection_prompt()?;
5052

system-reinstall-bootc/src/podman.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ use bootc_utils::CommandRunExt;
66
use std::process::Command;
77
use which::which;
88

9+
pub(crate) fn print_command(command: &Command) -> String {
10+
let program = command.get_program().to_string_lossy();
11+
let args = command
12+
.get_args()
13+
.map(|arg| arg.to_string_lossy())
14+
.collect::<Vec<_>>()
15+
.join(" ");
16+
format!("{} {}", program, args)
17+
}
18+
919
pub(crate) fn reinstall_command(image: &str, ssh_key_file: &str) -> Command {
1020
let mut podman_command_and_args = [
1121
// We use podman to run the bootc container. This might change in the future to remove the

0 commit comments

Comments
 (0)