mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-26 05:29:38 +01:00
xtask: Rename: name->command, command->executable
This commit is contained in:
parent
3908cbf7e8
commit
81ca906043
1 changed files with 16 additions and 16 deletions
|
@ -91,7 +91,7 @@ pub enum CargoCommand<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CargoCommand<'a> {
|
impl<'a> CargoCommand<'a> {
|
||||||
fn name(&self) -> &str {
|
fn command(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
CargoCommand::Run { .. } | CargoCommand::Qemu { .. } => "run",
|
CargoCommand::Run { .. } | CargoCommand::Qemu { .. } => "run",
|
||||||
CargoCommand::ExampleCheck { .. } | CargoCommand::Check { .. } => "check",
|
CargoCommand::ExampleCheck { .. } | CargoCommand::Check { .. } => "check",
|
||||||
|
@ -104,7 +104,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
CargoCommand::Test { .. } => "test",
|
CargoCommand::Test { .. } => "test",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn command(&self) -> &str {
|
pub fn executable(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
CargoCommand::Run { .. }
|
CargoCommand::Run { .. }
|
||||||
| CargoCommand::Qemu { .. }
|
| CargoCommand::Qemu { .. }
|
||||||
|
@ -135,7 +135,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
if let Some(cargoarg) = cargoarg {
|
if let Some(cargoarg) = cargoarg {
|
||||||
args.extend_from_slice(&[cargoarg]);
|
args.extend_from_slice(&[cargoarg]);
|
||||||
}
|
}
|
||||||
args.extend_from_slice(&[self.name(), "--example", example, "--target", target]);
|
args.extend_from_slice(&[self.command(), "--example", example, "--target", target]);
|
||||||
|
|
||||||
if let Some(feature) = features {
|
if let Some(feature) = features {
|
||||||
args.extend_from_slice(&["--features", feature]);
|
args.extend_from_slice(&["--features", feature]);
|
||||||
|
@ -156,7 +156,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
if let Some(cargoarg) = cargoarg {
|
if let Some(cargoarg) = cargoarg {
|
||||||
args.extend_from_slice(&[cargoarg]);
|
args.extend_from_slice(&[cargoarg]);
|
||||||
}
|
}
|
||||||
args.extend_from_slice(&[self.name(), "--example", example, "--target", target]);
|
args.extend_from_slice(&[self.command(), "--example", example, "--target", target]);
|
||||||
|
|
||||||
if let Some(feature) = features {
|
if let Some(feature) = features {
|
||||||
args.extend_from_slice(&["--features", feature]);
|
args.extend_from_slice(&["--features", feature]);
|
||||||
|
@ -178,7 +178,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
args.extend_from_slice(&[cargoarg]);
|
args.extend_from_slice(&[cargoarg]);
|
||||||
}
|
}
|
||||||
|
|
||||||
args.extend_from_slice(&[self.name(), "--target", target]);
|
args.extend_from_slice(&[self.command(), "--target", target]);
|
||||||
|
|
||||||
if let Some(package) = package {
|
if let Some(package) = package {
|
||||||
args.extend_from_slice(&["--package", package.name()]);
|
args.extend_from_slice(&["--package", package.name()]);
|
||||||
|
@ -203,7 +203,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
if let Some(cargoarg) = cargoarg {
|
if let Some(cargoarg) = cargoarg {
|
||||||
args.extend_from_slice(&[cargoarg]);
|
args.extend_from_slice(&[cargoarg]);
|
||||||
}
|
}
|
||||||
args.extend_from_slice(&[self.name()]);
|
args.extend_from_slice(&[self.command()]);
|
||||||
|
|
||||||
if let Some(package) = package {
|
if let Some(package) = package {
|
||||||
args.extend_from_slice(&["--package", package.name()]);
|
args.extend_from_slice(&["--package", package.name()]);
|
||||||
|
@ -228,7 +228,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
args.extend_from_slice(&[cargoarg]);
|
args.extend_from_slice(&[cargoarg]);
|
||||||
}
|
}
|
||||||
|
|
||||||
args.extend_from_slice(&[self.name()]);
|
args.extend_from_slice(&[self.command()]);
|
||||||
|
|
||||||
if let Some(package) = package {
|
if let Some(package) = package {
|
||||||
args.extend_from_slice(&["--package", package.name()]);
|
args.extend_from_slice(&["--package", package.name()]);
|
||||||
|
@ -249,7 +249,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
args.extend_from_slice(&[cargoarg]);
|
args.extend_from_slice(&[cargoarg]);
|
||||||
}
|
}
|
||||||
|
|
||||||
args.extend_from_slice(&[self.name()]);
|
args.extend_from_slice(&[self.command()]);
|
||||||
|
|
||||||
if let Some(feature) = features {
|
if let Some(feature) = features {
|
||||||
args.extend_from_slice(&["--features", feature]);
|
args.extend_from_slice(&["--features", feature]);
|
||||||
|
@ -267,7 +267,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
test,
|
test,
|
||||||
} => {
|
} => {
|
||||||
let mut args = vec!["+nightly"];
|
let mut args = vec!["+nightly"];
|
||||||
args.extend_from_slice(&[self.name()]);
|
args.extend_from_slice(&[self.command()]);
|
||||||
|
|
||||||
if let Some(package) = package {
|
if let Some(package) = package {
|
||||||
args.extend_from_slice(&["--package", package.name()]);
|
args.extend_from_slice(&["--package", package.name()]);
|
||||||
|
@ -290,7 +290,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If no argument given, run mdbook build
|
// If no argument given, run mdbook build
|
||||||
args.extend_from_slice(&[self.name()]);
|
args.extend_from_slice(&[self.command()]);
|
||||||
}
|
}
|
||||||
args.extend_from_slice(&["book/en"]);
|
args.extend_from_slice(&["book/en"]);
|
||||||
args
|
args
|
||||||
|
@ -300,7 +300,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
package,
|
package,
|
||||||
check_only,
|
check_only,
|
||||||
} => {
|
} => {
|
||||||
let mut args = vec!["+nightly", self.name()];
|
let mut args = vec!["+nightly", self.command()];
|
||||||
if let Some(cargoarg) = cargoarg {
|
if let Some(cargoarg) = cargoarg {
|
||||||
args.extend_from_slice(&[cargoarg]);
|
args.extend_from_slice(&[cargoarg]);
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
if let Some(cargoarg) = cargoarg {
|
if let Some(cargoarg) = cargoarg {
|
||||||
args.extend_from_slice(&[cargoarg]);
|
args.extend_from_slice(&[cargoarg]);
|
||||||
}
|
}
|
||||||
args.extend_from_slice(&[self.name(), "--example", example, "--target", target]);
|
args.extend_from_slice(&[self.command(), "--example", example, "--target", target]);
|
||||||
|
|
||||||
if let Some(feature) = features {
|
if let Some(feature) = features {
|
||||||
args.extend_from_slice(&["--features", feature]);
|
args.extend_from_slice(&["--features", feature]);
|
||||||
|
@ -346,7 +346,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
if let Some(cargoarg) = cargoarg {
|
if let Some(cargoarg) = cargoarg {
|
||||||
args.extend_from_slice(&[cargoarg]);
|
args.extend_from_slice(&[cargoarg]);
|
||||||
}
|
}
|
||||||
args.extend_from_slice(&[self.name(), "--example", example, "--target", target]);
|
args.extend_from_slice(&[self.command(), "--example", example, "--target", target]);
|
||||||
|
|
||||||
if let Some(feature) = features {
|
if let Some(feature) = features {
|
||||||
args.extend_from_slice(&["--features", feature]);
|
args.extend_from_slice(&["--features", feature]);
|
||||||
|
@ -368,7 +368,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
if let Some(cargoarg) = cargoarg {
|
if let Some(cargoarg) = cargoarg {
|
||||||
args.extend_from_slice(&[cargoarg]);
|
args.extend_from_slice(&[cargoarg]);
|
||||||
}
|
}
|
||||||
args.extend_from_slice(&[self.name(), "--example", example, "--target", target]);
|
args.extend_from_slice(&[self.command(), "--example", example, "--target", target]);
|
||||||
|
|
||||||
if let Some(feature_name) = features {
|
if let Some(feature_name) = features {
|
||||||
args.extend_from_slice(&["--features", feature_name]);
|
args.extend_from_slice(&["--features", feature_name]);
|
||||||
|
@ -413,9 +413,9 @@ impl fmt::Display for BuildMode {
|
||||||
pub fn run_command(command: &CargoCommand) -> anyhow::Result<RunResult> {
|
pub fn run_command(command: &CargoCommand) -> anyhow::Result<RunResult> {
|
||||||
let (mut reader, writer) = pipe()?;
|
let (mut reader, writer) = pipe()?;
|
||||||
let (mut error_reader, error_writer) = pipe()?;
|
let (mut error_reader, error_writer) = pipe()?;
|
||||||
debug!("👟 {} {}", command.command(), command.args().join(" "));
|
debug!("👟 {} {}", command.executable(), command.args().join(" "));
|
||||||
|
|
||||||
let mut handle = Command::new(command.command())
|
let mut handle = Command::new(command.executable())
|
||||||
.args(command.args())
|
.args(command.args())
|
||||||
.stdout(writer)
|
.stdout(writer)
|
||||||
.stderr(error_writer)
|
.stderr(error_writer)
|
||||||
|
|
Loading…
Reference in a new issue