feat(cli): block out cli
blocked out the args and commands that will be implemented later
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
|||||||
|
use clap::{Args, Parser, Subcommand};
|
||||||
|
|
||||||
|
#[derive(Debug, Parser)]
|
||||||
|
#[command(version, about = "a cli to change git users")]
|
||||||
|
pub struct Cli {
|
||||||
|
#[command(subcommand)]
|
||||||
|
command: Commands,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Subcommand)]
|
||||||
|
pub enum Commands {
|
||||||
|
List,
|
||||||
|
Use(UseArgs),
|
||||||
|
Add(AddArgs),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Args)]
|
||||||
|
pub struct UseArgs {
|
||||||
|
pub profile_name: String,
|
||||||
|
#[arg(short, long)]
|
||||||
|
pub global: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Args)]
|
||||||
|
pub struct AddArgs {
|
||||||
|
pub profile_name: String,
|
||||||
|
#[arg(long)]
|
||||||
|
pub name: String,
|
||||||
|
#[arg(long)]
|
||||||
|
pub email: String,
|
||||||
|
}
|
||||||
+6
-1
@@ -1,3 +1,8 @@
|
|||||||
|
use clap::Parser;
|
||||||
|
|
||||||
|
mod cli;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Hello, git!");
|
let args = cli::Cli::parse();
|
||||||
|
println!("{:?}", args);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user