-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add subcommands to manage the xwin installation
- Loading branch information
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use std::{path::PathBuf, process::Command}; | ||
|
||
use anyhow::Result; | ||
use cargo_options::heading; | ||
use clap::Parser; | ||
|
||
use crate::common::XWinOptions; | ||
|
||
#[derive(Clone, Debug, Default, Parser)] | ||
#[command( | ||
display_order = 1, | ||
about = "Run init command", | ||
after_help = "", | ||
)] | ||
pub struct InitXWin { | ||
#[command(flatten)] | ||
common: cargo_options::CommonOptions, | ||
|
||
/// Path to Cargo.toml | ||
#[arg(long, value_name = "PATH", help_heading = heading::MANIFEST_OPTIONS)] | ||
pub manifest_path: Option<PathBuf>, | ||
|
||
#[command(flatten)] | ||
xwin: XWinOptions, | ||
} | ||
|
||
impl InitXWin { | ||
pub fn execute(&self) -> Result<()> { | ||
let mut build = Command::new(""); | ||
self.xwin.apply_command_env( | ||
self.manifest_path.as_deref(), | ||
&self.common, | ||
&mut build, | ||
)?; | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
mod common; | ||
mod init_xwin; | ||
mod macros; | ||
mod run; | ||
mod test; | ||
|
||
pub use common::XWinOptions; | ||
pub use init_xwin::InitXWin; | ||
pub use macros::{build::Build, check::Check, clippy::Clippy, rustc::Rustc}; | ||
pub use run::Run; | ||
pub use test::Test; |