aboutsummaryrefslogtreecommitdiff
path: root/dotup_cli/src/commands/init.rs
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2021-07-08 17:11:46 -0400
committerdiogo464 <[email protected]>2021-07-08 17:11:46 -0400
commited0baec0a3f953c99445f6842dadc5566e89cb75 (patch)
tree9f988c41db34907283dd126dc57d29b3d0792bd9 /dotup_cli/src/commands/init.rs
Initial commit
Diffstat (limited to 'dotup_cli/src/commands/init.rs')
-rw-r--r--dotup_cli/src/commands/init.rs20
1 files changed, 20 insertions, 0 deletions
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 @@
1use clap::Clap;
2
3use super::prelude::*;
4
5#[derive(Clap)]
6pub struct Opts {}
7
8pub fn main(config: Config, opts: Opts) -> anyhow::Result<()> {
9 if !dotup::utils::is_file(&config.archive_path)? {
10 let archive = Archive::default();
11 log::info!("Creating archive");
12 utils::write_archive(&config.archive_path, &archive)?;
13 } else {
14 log::info!(
15 "Archive file already exists : {}",
16 config.archive_path.display()
17 );
18 }
19 Ok(())
20}