aboutsummaryrefslogtreecommitdiff
path: root/src/cliargs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cliargs.rs')
-rw-r--r--src/cliargs.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cliargs.rs b/src/cliargs.rs
index 3c302f4..d4fac46 100644
--- a/src/cliargs.rs
+++ b/src/cliargs.rs
@@ -31,7 +31,7 @@ pub struct CLIArgs {
pub helparg: bool,
pub versionarg: bool,
pub pos_args: Vec<PathBuf>,
- pub cfg_path: PathBuf,
+ pub cfg_path: Option<PathBuf>,
pub light_theme: bool,
}
@@ -42,16 +42,18 @@ impl CLIArgs {
// Default config
args.cfg_path = if config_dir().is_some() {
- config_dir().unwrap().join("bibiman/bibiman.toml")
+ Some(config_dir().unwrap().join("bibiman/bibiman.toml"))
+ } else if home_dir().is_some() {
+ Some(home_dir().unwrap().join(".config/bibiman/bibiman.toml"))
} else {
- home_dir().unwrap().join(".config/bibiman/bibiman.toml")
+ None
};
while let Some(arg) = parser.next()? {
match arg {
Short('h') | Long("help") => args.helparg = true,
Short('v') | Long("version") => args.versionarg = true,
- Short('c') | Long("config-file") => args.cfg_path = parser.value()?.parse()?,
+ Short('c') | Long("config-file") => args.cfg_path = Some(parser.value()?.parse()?),
Long("light-terminal") => args.light_theme = true,
// Value(pos_arg) => parse_files(&mut args, pos_arg),
Value(pos_arg) => args.pos_args.push(pos_arg.into()),