use clap::{Parser, Subcommand};
use std::env;
#[derive(Parser)]
#[command(
author = "Gokul <@bahdotsh>",
version = env!("CARGO_PKG_VERSION"),
about = "snipt - A text snippet expansion tool",
long_about = "snipt allows you to define text snippets and expand them as you type."
)]
pub struct Snipt {
#[clap(subcommand)]
pub commands: Option<Commands>,
}
#[derive(Subcommand)]
pub enum Commands {
Add {
#[clap(long, short = 's', help = "Shortcut for the snippet")]
shortcut: String,
#[clap(long, short = 'c', help = "The snippet text")]
snippet: String,
},
Delete {
#[clap(long, short, help = "Shortcut of the snippet to delete")]
shortcut: String,
},
Update {
#[clap(long, short = 's', help = "Shortcut of the snippet to update")]
shortcut: String,
#[clap(long, short = 'c', help = "New snippet text")]
snippet: String,
},
New,
Start {
#[clap(long, short, default_value = "3000", help = "Port for the API server")]
port: u16,
},
Stop,
Status,
List,
Serve {
#[clap(long, short, default_value = "3000", help = "Port to listen on")]
port: u16,
},
Port,
ApiStatus,
ApiDiagnose,
#[clap(hide = true)]
DaemonWorker,
}