use clap::{Parser, Subcommand};
#[derive(Debug, Parser)]
#[command(
name = "entangle",
about = "Easy setup for mirroring GitHub repos to Tangled.org",
long_about = "entangle configures your git remotes so that a single `git push` \
sends your code to both GitHub and Tangled.org simultaneously.\n\n\
Quickstart:\n \
1. entangle setup # configure your usernames once\n \
2. entangle init # wire up remotes in this repo\n \
3. entangle shove # first-time push to both forges",
version
)]
pub struct Cli {
#[command(subcommand)]
pub command: Option<Commands>,
}
#[derive(Debug, Subcommand)]
pub enum Commands {
Setup,
Set {
#[arg(value_name = "KEY")]
key: SetKey,
#[arg(value_name = "VALUE")]
value: String,
},
Init {
#[arg(value_name = "REPO")]
repo: Option<String>,
#[arg(value_name = "ALIAS")]
alias: Option<String>,
#[arg(short = 'q', long = "quiet", conflicts_with = "debug")]
quiet: bool,
#[arg(long = "debug", conflicts_with = "quiet")]
debug: bool,
},
Shove,
}
#[derive(Debug, Clone, clap::ValueEnum)]
pub enum SetKey {
#[value(name = "gh-user", alias = "github-user")]
GithubUser,
#[value(name = "tngl-user", alias = "tangled-user")]
TangledUser,
#[value(name = "origin")]
Origin,
}