summaryrefslogtreecommitdiffstats
path: root/src/cli
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2022-07-04 20:49:55 +0200
committerCanop <cano.petrole@gmail.com>2022-07-04 20:49:55 +0200
commit5666e6b9fb827c07c6c21fbe0fc60f538e1aaf60 (patch)
treec5e271b91edcde4da7dcfd8f0d9f0899ca2a16bd /src/cli
parentc688a083b46628f1a9c7a23d1765016177514be4 (diff)
default conf is now a directory
and not just a file, thanks to imports. And it contains skin files. Fix #431 Fix #340
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/args.rs4
-rw-r--r--src/cli/mod.rs9
2 files changed, 11 insertions, 2 deletions
diff --git a/src/cli/args.rs b/src/cli/args.rs
index 56ec4e5..a81d25e 100644
--- a/src/cli/args.rs
+++ b/src/cli/args.rs
@@ -146,6 +146,10 @@ pub struct Args {
#[clap(long, action)]
pub get_root: bool,
+ /// Write default conf files in given directory
+ #[clap(long, value_parser)]
+ pub write_default_conf: Option<PathBuf>,
+
/// A socket that broot sends commands to before quitting
#[cfg(unix)]
#[clap(long, value_parser)]
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index c261be1..bd18a89 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -14,7 +14,7 @@ pub use {
use {
crate::{
app::{App, AppContext},
- conf::Conf,
+ conf::{Conf, write_default_conf_in},
display,
errors::ProgramError,
launchable::Launchable,
@@ -41,12 +41,17 @@ pub fn run() -> Result<Option<Launchable>, ProgramError> {
// parse the launch arguments we got from cli
let args = Args::parse();
+ let mut must_quit = false;
+
+ if let Some(dir) = &args.write_default_conf {
+ write_default_conf_in(dir)?;
+ must_quit = true;
+ }
// read the install related arguments
let install_args = InstallLaunchArgs::from(&args)?;
// execute installation things required by launch args
- let mut must_quit = false;
if let Some(state) = install_args.set_install_state {
write_state(state)?;
must_quit = true;