Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gitclaw"
version = "0.1.0"
version = "0.3.0"
edition = "2021"

[dependencies]
Expand Down
52 changes: 42 additions & 10 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,84 @@ use clap::{Parser, Subcommand};
use clap_complete::Shell;

#[derive(Parser)]
#[command(name = "gitclaw", about = "Install software from GitHub releases")]
#[command(
name = "gitclaw",
about = "Install software from GitHub releases",
version
)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,

#[arg(short, long, global = true, env = "GITHUB_TOKEN")]
#[arg(
short,
long,
global = true,
env = "GITHUB_TOKEN",
help = "GitHub token for authentication (optional)"
)]
pub token: Option<String>,
}

#[derive(Subcommand)]
pub enum Commands {
/// Install packages from GitHub releases
#[command(about = "Install packages from GitHub releases")]
Install {
#[arg(num_args = 1..)]
#[arg(num_args = 1.., help = "Package(s) to install (format: owner/repo or owner/repo@version)")]
packages: Vec<String>,
#[arg(short, long)]
#[arg(short, long, help = "Force reinstall even if already installed")]
force: bool,
#[arg(long)]
#[arg(long, help = "Show what would be installed without downloading")]
dry_run: bool,
#[arg(long)]
#[arg(long, help = "Verify checksums after download")]
verify: bool,
},
/// List installed packages
#[command(about = "List installed packages")]
List {
#[arg(short, long)]
#[arg(short, long, help = "Show detailed information")]
verbose: bool,
},
/// Update installed packages
#[command(about = "Update installed packages")]
Update {
#[arg(help = "Package to update (omit to update all)")]
package: Option<String>,
},
/// Uninstall a package
#[command(about = "Uninstall a package")]
Uninstall {
#[arg(help = "Package to uninstall (format: owner/repo)")]
package: String,
},
/// Search for releases on GitHub
#[command(about = "Search for releases on GitHub")]
Search {
#[arg(help = "Repository to search (format: owner/repo)")]
package: String,
#[arg(short, long, default_value = "10")]
#[arg(
short,
long,
default_value = "10",
help = "Maximum number of releases to show"
)]
limit: usize,
},
/// Generate shell completions
#[command(about = "Generate shell completions")]
Completions {
#[arg(value_enum)]
#[arg(value_enum, help = "Shell to generate completions for")]
shell: Shell,
},
/// Show platform information
#[command(about = "Show platform information")]
Platform {},
/// Update gitclaw itself
#[command(about = "Update gitclaw to the latest version")]
SelfUpdate {
/// Only check for updates, don't install
#[arg(long)]
#[arg(long, help = "Only check for updates, don't install")]
check: bool,
},
}
Loading