From ed0baec0a3f953c99445f6842dadc5566e89cb75 Mon Sep 17 00:00:00 2001 From: diogo464 Date: Thu, 8 Jul 2021 17:11:46 -0400 Subject: Initial commit --- dotup_cli/src/commands/init.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 dotup_cli/src/commands/init.rs (limited to 'dotup_cli/src/commands/init.rs') diff --git a/dotup_cli/src/commands/init.rs b/dotup_cli/src/commands/init.rs new file mode 100644 index 0000000..bfec6ca --- /dev/null +++ b/dotup_cli/src/commands/init.rs @@ -0,0 +1,20 @@ +use clap::Clap; + +use super::prelude::*; + +#[derive(Clap)] +pub struct Opts {} + +pub fn main(config: Config, opts: Opts) -> anyhow::Result<()> { + if !dotup::utils::is_file(&config.archive_path)? { + let archive = Archive::default(); + log::info!("Creating archive"); + utils::write_archive(&config.archive_path, &archive)?; + } else { + log::info!( + "Archive file already exists : {}", + config.archive_path.display() + ); + } + Ok(()) +} -- cgit