Initial commit

This commit is contained in:
2025-04-03 13:25:43 +02:00
commit 7cf082535e
7 changed files with 2461 additions and 0 deletions

54
src/main.rs Normal file
View File

@@ -0,0 +1,54 @@
use std::path::PathBuf;
use clap::{CommandFactory, Parser, command};
use clap_complete::{Shell, generate};
#[derive(Parser, Debug)]
#[command(version, about)]
struct Args {
#[command(subcommand)]
command: Command,
#[arg(short, long)]
config: PathBuf,
}
#[derive(Parser, Debug, Clone)]
enum Command {
/// Mirror repositories as specified in the config
Rror,
/// Create a linktree of the latest backups of the repositories, for use with cgit et al.
Linktree,
/// Validate the configuration provided configuration file
ValidateConfig,
/// Generate shell completions
#[command(hide = true)]
GenerateCompletions(GenerateCompletionArgs),
}
#[derive(Parser, Debug, Clone)]
struct GenerateCompletionArgs {
#[arg(long, default_value = "bash")]
shell: Shell,
}
fn main() {
let args = Args::parse();
match args.command {
Command::GenerateCompletions(args) => {
generate(
args.shell,
&mut Args::command(),
"kagami",
&mut std::io::stdout(),
);
}
_ => {
unimplemented!()
}
}
}