added a little bit of the commands

This commit is contained in:
2026-07-13 17:11:38 -05:00
parent 3009504e8d
commit 04c57f15f8
4 changed files with 1379 additions and 14 deletions
+56
View File
@@ -0,0 +1,56 @@
use clap::{Args, Parser, Subcommand};
#[derive(Parser)]
#[clap(
name = "Harbor",
version,
about = "An open source secrets management and distribution platform"
)]
#[command(disable_version_flag = true)]
pub struct Cli {
#[arg(short = 'v', long, help = "Print version")]
pub version: bool,
#[command(subcommand)]
pub command: Option<Commands>,
}
#[derive(Subcommand)]
pub enum Commands {
Inject(InjectArgs),
Shell {},
Add {},
Setup {},
List {},
Project {
#[command(subcommand)]
command: ProjectCommands,
},
Config {
#[command(subcommand)]
command: ConfigCommands,
},
}
#[derive(Args, Debug)]
pub struct InjectArgs {
#[arg(short, long)]
pub verbose: bool,
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
pub after: Vec<String>,
}
#[derive(Subcommand)]
pub enum ProjectCommands {
List {},
Create { name: String },
Delete { name: String },
}
#[derive(Subcommand)]
pub enum ConfigCommands {
List {},
Create { project: String, name: String },
Delete { project: String, name: String },
}
+30 -1
View File
@@ -1,3 +1,32 @@
use std::process;
use clap::Parser;
use clap::crate_version;
use cli::Cli;
use colored::*;
use git_version::git_version;
const GIT_VERSION: &str = git_version!();
fn main() {
println!("Hello, world!");
let cli = Cli::parse();
if cli.version {
let top_msg = format!("Harbor version {}", crate_version!().green()).bright_blue();
let bottom_msg =
format!("An open source secrets management and distribution platform.").blue();
let commit_msg = format!("Git commit {}", GIT_VERSION).dimmed();
println!("{}\n{}\n{}", top_msg, bottom_msg, commit_msg);
process::exit(0);
}
if cli.command.is_none() {
println!(
"{}\n{}",
"No command was entered.".red(),
"Exiting...".dimmed()
);
process::exit(0);
}
}