diff --git a/.gitignore b/.gitignore index 3ca43ae..8468d5a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ Cargo.lock # MSVC Windows builds of rustc generate these, which store debugging information *.pdb +# All vim swap files of vim +*.sw? diff --git a/Cargo.toml b/Cargo.toml index 94a0fc0..5ace58e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,3 +6,4 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +clap = { version = "4.5.16", features = ["derive"] } diff --git a/src/main.rs b/src/main.rs index e7a11a9..36a7278 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,37 @@ +use clap::{Parser, Subcommand}; + +#[derive(Parser)] +#[command(name = "mps", version = "0.0.1", about = "MyPasswordStorage: Tool for storing your passwords locally with synchronization with git.")] +struct Cli { + #[command(subcommand)] + command: Option, +} + +#[derive(Subcommand)] +enum Commands { + + /// Initialisation of storage and config, use this in first time of usage of mps + Init, + + /// Adds new item with unique id to the db + Add { + #[arg(value_name="item_id")] + input: String + } + +} + fn main() { - println!("Hello, world!"); + let cli = Cli::parse(); + match &cli.command { + Some(Commands::Init) => { + println!("Initializing storage and config."); + } + Some(Commands::Add{input}) => { + println!("about to add new item"); + } + None => { + println!("Will be here init or list if storage inited"); + } + } }