Initial upload with CI/CD workflow
This commit is contained in:
48
app/src/cli/mod.rs
Normal file
48
app/src/cli/mod.rs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
use clap::{Parser, Args, Subcommand};
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
#[derive(Parser, Debug)]
|
||||||
|
#[command(name = "tui-generator")]
|
||||||
|
#[command(author = "TUI Generator Contributors")]
|
||||||
|
#[command(version = "0.1.0")]
|
||||||
|
#[command(about = "Generate beautiful, interactive terminal user interfaces for CLI tools", long_about = None)]
|
||||||
|
pub struct Cli {
|
||||||
|
#[command(subcommand)]
|
||||||
|
pub command: Commands,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Subcommand, Debug)]
|
||||||
|
pub enum Commands {
|
||||||
|
#[command(about = "Generate TUI from a CLI command's help output")]
|
||||||
|
Generate {
|
||||||
|
#[arg(help = "The CLI command to parse (e.g., 'git', 'kubectl get')")]
|
||||||
|
command: String,
|
||||||
|
#[arg(short, long, help = "Output file path for the configuration")]
|
||||||
|
output: Option<PathBuf>,
|
||||||
|
},
|
||||||
|
#[command(about = "Launch interactive TUI for command exploration")]
|
||||||
|
Interactive {
|
||||||
|
#[arg(help = "Optional command to start with")]
|
||||||
|
command: Option<String>,
|
||||||
|
},
|
||||||
|
#[command(about = "Export parsed command configuration")]
|
||||||
|
Export {
|
||||||
|
#[arg(help = "The CLI command to export")]
|
||||||
|
command: String,
|
||||||
|
#[arg(help = "Output file path")]
|
||||||
|
output: PathBuf,
|
||||||
|
},
|
||||||
|
#[command(about = "List saved configurations")]
|
||||||
|
List,
|
||||||
|
#[command(about = "Run a saved configuration")]
|
||||||
|
Run {
|
||||||
|
#[arg(help = "Name of the saved configuration")]
|
||||||
|
name: String,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Cli {
|
||||||
|
pub fn parse() -> Self {
|
||||||
|
Self::parse_from(std::env::args_os())
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user