From 74a90b975d7a448950625bc767b8052fe8bef0d4 Mon Sep 17 00:00:00 2001 From: diogo464 Date: Wed, 14 Jul 2021 14:24:51 +0100 Subject: Removed .rustfmt file --- dotup_cli/src/.main.rs.rustfmt | 87 ------------------------------------------ 1 file changed, 87 deletions(-) delete mode 100644 dotup_cli/src/.main.rs.rustfmt (limited to 'dotup_cli') diff --git a/dotup_cli/src/.main.rs.rustfmt b/dotup_cli/src/.main.rs.rustfmt deleted file mode 100644 index 6d020e1..0000000 --- a/dotup_cli/src/.main.rs.rustfmt +++ /dev/null @@ -1,87 +0,0 @@ -#![allow(unused)] - -pub mod commands; -pub mod config; - -pub use config::Config; - -pub mod prelude { - pub use super::Config; - pub use dotup::{Archive, Depot, DepotConfig, Link, LinkDesc, LinkID}; -} - -use clap::{AppSettings, Clap}; -use flexi_logger::Logger; -use std::{ - collections::HashMap, - iter::FromIterator, - path::{Path, PathBuf}, -}; - -use prelude::*; - -const DEFAULT_DEPOT_NAME: &str = "depot.toml"; - -#[derive(Clap)] -#[clap(version = "0.1", author = "d464")] -#[clap(setting = AppSettings::ColoredHelp)] -struct Opts { - /// Path to the depot file. - #[clap(long, default_value = DEFAULT_DEPOT_NAME)] - depot: PathBuf, - - /// Disable output to the console - #[clap(short, long)] - quiet: bool, - - /// A level of verbosity, and can be used multiple times - /// - /// Level 0 - Warnings (Default) - /// Level 1 - Info - /// Level 2 - Debug - /// Level 3 - Trace - #[clap(short, long, parse(from_occurrences))] - verbose: i32, - - #[clap(subcommand)] - subcmd: SubCommand, -} - -#[derive(Clap)] -enum SubCommand { - Init(commands::init::Opts), - Link(commands::link::Opts), - Unlink(commands::unlink::Opts), - Install(commands::install::Opts), - Uninstall(commands::uninstall::Opts), -} - -fn main() -> anyhow::Result<()> { - let opts = Opts::parse(); - - if !opts.quiet { - let log_level = match opts.verbose { - 0 => "warn", - 1 => "info", - 2 => "debug", - 3 | _ => "trace", - }; - - Logger::try_with_env_or_str(log_level)? - .format(flexi_logger::colored_default_format) - //.set_palette("196;208;32;198;15".to_string()) - .start()?; - } - - let config = Config { - archive_path: opts.depot, - }; - - match opts.subcmd { - SubCommand::Init(opts) => commands::init::main(config, opts), - SubCommand::Link(opts) => commands::link::main(config, opts), - SubCommand::Unlink(opts) => commands::unlink::main(config, opts), - SubCommand::Install(opts) => commands::install::main(config, opts), - SubCommand::Uninstall(opts) => commands::uninstall::main(config, opts), - } -} -- cgit