cargo_run/commands/
mod.rs

1//! This module defines the commands and their execution logic for the cargo-script CLI tool.
2//!
3//! It includes functionalities to run scripts, initialize the Scripts.toml file, and handle script execution.
4
5use clap::{Subcommand, ArgAction};
6
7/// Enum representing the different commands supported by the CLI tool.
8#[derive(Subcommand, Debug)]
9pub enum Commands {
10    #[command(about = "Run a script by name defined in Scripts.toml")]
11    Run {
12        #[arg(value_name = "SCRIPT_NAME", action = ArgAction::Set)]
13        script: String,
14        #[arg(short, long, value_name = "KEY=VALUE", action = ArgAction::Append)]
15        env: Vec<String>,
16    },
17    #[command(about = "Initialize a Scripts.toml file in the current directory")]
18    Init,
19    #[command(about = "Show all script names and descriptions defined in Scripts.toml")]
20    Show,
21}
22
23pub mod init;
24pub mod script;
25pub mod show;