1use clap::{Parser, Subcommand};
2use std::env;
3
4#[derive(Parser)]
5#[command(
6 author = "Gokul <@bahdotsh>",
7 version = env!("CARGO_PKG_VERSION"),
8 about = "snipt - A text snippet expansion tool",
9 long_about = "snipt allows you to define text snippets and expand them as you type."
10)]
11pub struct Snipt {
12 #[clap(subcommand)]
13 pub commands: Option<Commands>,
14}
15
16#[derive(Subcommand)]
17pub enum Commands {
18 Add {
20 #[clap(long, short = 's', help = "Shortcut for the snippet")]
21 shortcut: String,
22
23 #[clap(long, short = 'c', help = "The snippet text")]
24 snippet: String,
25 },
26 Delete {
28 #[clap(long, short, help = "Shortcut of the snippet to delete")]
29 shortcut: String,
30 },
31 Update {
33 #[clap(long, short = 's', help = "Shortcut of the snippet to update")]
34 shortcut: String,
35
36 #[clap(long, short = 'c', help = "New snippet text")]
37 snippet: String,
38 },
39 New,
41 Start {
43 #[clap(long, short, default_value = "3000", help = "Port for the API server")]
44 port: u16,
45 },
46 Stop,
48 Status,
50 List,
52 Serve {
54 #[clap(long, short, default_value = "3000", help = "Port to listen on")]
55 port: u16,
56 },
57 Port,
59 ApiStatus,
61 ApiDiagnose,
63 #[clap(hide = true)]
65 DaemonWorker,
66}