feat: move install commands from xtask into clap subcommands
This commit is contained in:
1 parent
4dad85473b
commit
3acc577aac
15 files changed
+463
-381
No files matched your search
+10
-16
@@ -1,12 +1,9 @@
|
||||
mod install_files;
|
||||
mod record_screencasts;
|
||||
mod task_error;
|
||||
|
||||
use std::{path::PathBuf, process::ExitCode};
|
||||
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
use crate::install_files::{InstallOptions, UninstallOptions, install_files, uninstall_files};
|
||||
use clap::{Args, Parser, Subcommand};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(about = "Repository tasks for bootvine")]
|
||||
@@ -21,23 +18,20 @@ enum Task {
|
||||
about = "Record the README screencasts with vhs and copy the passphrase screenshot into \
|
||||
recordings/"
|
||||
)]
|
||||
RecordScreencasts {
|
||||
#[arg(long, help = "passphrase.png produced by the vm-luks-passphrase check")]
|
||||
passphrase_png: PathBuf,
|
||||
},
|
||||
#[command(about = "Build bootvine and install the binary, units and initrd hook")]
|
||||
Install(InstallOptions),
|
||||
#[command(about = "Remove what install put in place")]
|
||||
Uninstall(UninstallOptions),
|
||||
RecordScreencasts(RecordScreencastsOptions),
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
struct RecordScreencastsOptions {
|
||||
#[arg(long, help = "passphrase.png produced by the vm-luks-passphrase check")]
|
||||
passphrase_png: PathBuf,
|
||||
}
|
||||
|
||||
fn main() -> ExitCode {
|
||||
let outcome = match RepoTasks::parse().task {
|
||||
Task::RecordScreencasts { passphrase_png } => {
|
||||
record_screencasts::record_screencasts(&passphrase_png)
|
||||
Task::RecordScreencasts(options) => {
|
||||
record_screencasts::record_screencasts(&options.passphrase_png)
|
||||
}
|
||||
Task::Install(options) => install_files(&options),
|
||||
Task::Uninstall(options) => uninstall_files(&options),
|
||||
};
|
||||
match outcome {
|
||||
Ok(()) => ExitCode::SUCCESS,
|
||||
|
||||
Reference in new issue
Block a user