let mut command = Command::new("sudo");
if let Some(user) = user {
command.arg("--user").arg(user);
}
command.arg(<program>);
pattern there.
Now you can write
let mut command = user.run(<program>);
This is only a small first step, we should think about moving other structs and functions (like chmod) into the common lib. Especially the config structs so flake-ctl and the pilots can share them.
Create a
User
struct and move thepattern there.
Now you can write
This is only a small first step, we should think about moving other structs and functions (like chmod) into the common lib. Especially the config structs so flake-ctl and the pilots can share them.