use clap::{Parser, Subcommand};
const HELP_TEMPLATE: &str = "
_ _ ____ __
| | / \\ / _\\ V /
| |_ | o ( (_ \\ /
|___||_n_|\\__||_|
v{version}
https://github.com/timothebot/lacy
{about}{before-help}
{usage-heading}
{tab}{usage}
{all-args}{after-help}
";
#[derive(Parser, Debug)]
#[command(
version,
about,
override_usage="lacy init --help",
help_template=HELP_TEMPLATE
)]
pub struct LacyCli {
#[command(subcommand)]
pub command: LacyCommand,
}
#[derive(Subcommand, Debug)]
#[command(version, help_template=HELP_TEMPLATE)]
pub enum LacyCommand {
Prompt(Prompt),
Init(Init),
Complete(Complete),
}
#[derive(Debug, Parser)]
#[command(version, help_template=HELP_TEMPLATE)]
pub struct Prompt {
pub query: String,
#[arg(long)]
pub return_all: bool,
}
#[derive(Debug, Parser)]
#[command(
version,
help_template=HELP_TEMPLATE,
after_help = "
To get started, you must include lacy in your shell config.
You can find more about why this is required in the docs.
If you don't know what shell you are using, run:
$ echo $SHELL
ZSH:
$ echo \"eval \\\"\\$(lacy init zsh)\\\"\" >> ~/.zshrc
Bash:
$ echo \"eval \\\"\\$(lacy init bash)\\\"\" >> ~/.bashrc
Fish:
$ echo \"lacy init fish | source\" >> ~/.config/fish/config.fish"
)]
pub struct Init {
pub shell: String,
#[arg(long, default_value = "cd")]
pub cd_cmd: String,
#[arg(long, default_value = "y")]
pub cmd: String,
#[arg(long)]
pub custom_fuzzy: Option<String>,
}
#[derive(Debug, Parser)]
#[command(version, help_template=HELP_TEMPLATE)]
pub struct Complete {
#[arg(default_value = "")]
pub query: String,
#[arg(long)]
pub basename: bool,
}