Skip to content

Commit

Permalink
.backup to store config files
Browse files Browse the repository at this point in the history
  • Loading branch information
nbari committed Dec 10, 2023
1 parent 6d00c55 commit 466b0fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/cli/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ use clap::{
builder::styling::{AnsiColor, Effects, Styles},
Arg, ColorChoice, Command,
};
use std::{env, path::Path};

pub fn new(config_path: &Path) -> Command {
let config_file_path = config_path.join("config.yml");
use std::{env, path::PathBuf};

pub fn new(config_path: PathBuf) -> Command {
let styles = Styles::styled()
.header(AnsiColor::Yellow.on_default() | Effects::BOLD)
.usage(AnsiColor::Green.on_default() | Effects::BOLD)
Expand All @@ -27,7 +25,7 @@ pub fn new(config_path: &Path) -> Command {
.short('c')
.long("config")
.help("Path to the configuration files")
.default_value(config_file_path.into_os_string()),
.default_value(config_path.into_os_string()),
)
.subcommand(new::command())
.subcommand(edit::command())
Expand Down
4 changes: 2 additions & 2 deletions src/cli/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{fs, path::PathBuf};
pub fn get_config_path() -> Result<PathBuf> {
let home_dir = dirs::home_dir().map_or_else(|| PathBuf::from("/tmp"), |path| path);

let config_path = home_dir.join(".config").join("backup");
let config_path = home_dir.join(".backup");
fs::create_dir_all(&config_path).context(format!(
"failed to create config directory {}",
&config_path.display()
Expand All @@ -18,7 +18,7 @@ pub fn get_config_path() -> Result<PathBuf> {
pub fn start() -> Result<Action> {
let config_path = get_config_path()?;

let matches = commands::new(&config_path).get_matches();
let matches = commands::new(config_path).get_matches();

let action = handler(&matches)?;
Ok(action)
Expand Down

0 comments on commit 466b0fd

Please sign in to comment.