feat: compile time completion generation

Removed `completion` command in favor of compile time completion
generation. This tool will only be build from source for the foreseeable
future so this makes sense for now.
This commit is contained in:
2023-08-09 14:45:07 +02:00
parent e061d6dc6c
commit 2754a3bb30
4 changed files with 28 additions and 17 deletions

View File

@@ -1,6 +1,5 @@
use super::{Django, Docker, DockerCompose, Postgres};
use clap::{Parser, Subcommand};
use clap_complete::Shell;
/// A program for interacting with various dockerized applications.
#[derive(Parser, Debug)]
@@ -12,12 +11,6 @@ pub struct Ahab {
#[derive(Debug, Subcommand)]
pub enum Commands {
/// Generate completion files
Completion {
#[arg(value_enum)]
shell: Shell,
},
/// Docker related subcommands
Docker {
#[command(subcommand)]

View File

@@ -1,7 +1,7 @@
use ahab::{cli, scripts};
use anyhow::Result;
use clap::{CommandFactory, Parser};
use clap::Parser;
fn main() -> Result<()> {
// always load dotenv on start
@@ -13,15 +13,6 @@ fn main() -> Result<()> {
let args = cli::Ahab::parse();
match args.command {
cli::Commands::Completion { shell } => {
clap_complete::generate(
shell,
&mut cli::Ahab::command(),
"ahab",
&mut std::io::stdout(),
);
Ok(())
}
cli::Commands::Docker { command } => match command {
cli::Docker::StopAll => scripts::docker::stop_all(),
},