Firts Commit: new app
This commit is contained in:
55
src/cli.rs
Normal file
55
src/cli.rs
Normal file
@@ -0,0 +1,55 @@
|
||||
use clap::Parser;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name = "memoscli")]
|
||||
#[command(about = "A CLI tool to manage memos", long_about = None)]
|
||||
pub struct Cli {
|
||||
#[command(subcommand)]
|
||||
pub command: Option<Command>,
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
pub enum Command {
|
||||
Create(CreateCommand),
|
||||
List(ListCommand),
|
||||
Config(ConfigCommand),
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
pub struct CreateCommand {
|
||||
#[arg(short, long, help = "Content of the memo")]
|
||||
pub content: Option<String>,
|
||||
|
||||
#[arg(short, long, help = "Markdown file to use as content")]
|
||||
pub file: Option<PathBuf>,
|
||||
|
||||
#[arg(
|
||||
short,
|
||||
long,
|
||||
default_value = "PRIVATE",
|
||||
help = "Visibility: PUBLIC or PRIVATE"
|
||||
)]
|
||||
pub visibility: String,
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
pub struct ListCommand {
|
||||
#[arg(short, long, default_value = "20", help = "Number of memos to list")]
|
||||
pub limit: i32,
|
||||
|
||||
#[arg(short, long, default_value = "0", help = "Offset for pagination")]
|
||||
pub offset: i32,
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
pub struct ConfigCommand {
|
||||
#[arg(short, long, help = "Set the base URL")]
|
||||
pub base_url: Option<String>,
|
||||
|
||||
#[arg(short, long, help = "Set the user token")]
|
||||
pub token: Option<String>,
|
||||
|
||||
#[arg(short, long, action = clap::ArgAction::SetTrue, help = "Show current configuration")]
|
||||
pub show: bool,
|
||||
}
|
||||
Reference in New Issue
Block a user