From 9ed581acbb2a0cf11469b461aab1b7ce93aaba95 Mon Sep 17 00:00:00 2001 From: eatradish Date: Wed, 7 Aug 2024 16:33:52 +0800 Subject: [PATCH] feat: add `ciel update-os` argument `--force-use-apt` --- src/cli.rs | 6 +++++- src/main.rs | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 13aa707..ecebbc2 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -49,7 +49,11 @@ pub fn build_cli() -> Command { .arg(Arg::new("arch").short('a').long("arch").help("Specify the target architecture for fetching OS tarball")) .about("Unpack OS tarball or fetch the latest BuildKit from the repository"), ) - .subcommand(Command::new("update-os").about("Update the OS in the container")) + .subcommand( + Command::new("update-os") + .arg(Arg::new("force_use_apt").long("force-use-apt").help("Use apt to update-os")) + .about("Update the OS in the container") + ) .subcommand( Command::new("load-tree") .arg(Arg::new("url").default_value(GIT_TREE_URL).help("URL to the git repository")) diff --git a/src/main.rs b/src/main.rs index b46119d..4f652bb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -218,8 +218,12 @@ fn main() -> Result<()> { ) }); } - ("update-os", _) => { - print_error!({ actions::update_os(read_config().is_ok_and(|x| x.force_use_apt)) }); + ("update-os", args) => { + print_error!({ + actions::update_os( + args.get_flag("force_use_apt") || read_config().is_ok_and(|x| x.force_use_apt), + ) + }); } ("config", args) => { if args.get_flag("g") {