alf/cli/mod.rs
1//! CLI argument parsing and command handling.
2
3pub mod config_cmd;
4pub mod init;
5
6use clap::{Parser, Subcommand};
7
8/// Alias & Function CLI Searching Tool
9#[derive(Debug, Parser)]
10#[command(name = "alf")]
11#[command(version, about, long_about = None, disable_help_subcommand = true)]
12pub struct Cli {
13 #[command(subcommand)]
14 pub command: Option<Commands>,
15}
16
17/// Available subcommands
18#[derive(Debug, Subcommand)]
19pub enum Commands {
20 /// Activate shell integration by printing the wrapper function
21 Activate {
22 /// Shell to generate the wrapper for (zsh, bash)
23 shell: String,
24 },
25
26 /// Manage configuration
27 Config {
28 #[command(subcommand)]
29 action: ConfigAction,
30 },
31
32 /// Initialize configuration (first-run setup)
33 Init {
34 /// Print shell integration wrapper for the given shell and exit
35 #[arg(long, value_name = "SHELL")]
36 print_shell_hook: Option<String>,
37 },
38
39 /// Launch the interactive TUI search interface with required query
40 Search {
41 /// Required search query to filter results on startup
42 query: String,
43 },
44}
45
46/// Configuration management actions
47#[derive(Debug, Subcommand)]
48pub enum ConfigAction {
49 /// Show current configuration
50 Show,
51
52 /// Edit configuration file
53 Edit,
54
55 /// Reset to default configuration
56 Reset,
57}