feat: prepare initial cli layout

Made initial command scopes
d -> docker related commands
dc -> docker compose related commands
dj -> django related commands
pg -> postgres related commands
This commit is contained in:
2023-05-21 22:35:12 +02:00
parent f6e9c7953a
commit eb232a93f8
12 changed files with 220 additions and 0 deletions

View File

@@ -1,5 +1,39 @@
mod cli;
mod scripts;
use anyhow::Result;
use clap::Parser;
fn main() -> Result<()> {
let args = cli::Ahab::parse();
match args.command {
cli::Commands::D { command } => match command {
cli::Docker::StopAll => scripts::docker::stop_all(),
},
cli::Commands::Dc { command } => match command {
cli::DockerCompose::Build => scripts::docker_compose::build(),
cli::DockerCompose::Down => scripts::docker_compose::down(),
cli::DockerCompose::Rebuild => scripts::docker_compose::rebuild(),
cli::DockerCompose::Restart => scripts::docker_compose::restart(),
cli::DockerCompose::Start => scripts::docker_compose::start(),
cli::DockerCompose::Stop => scripts::docker_compose::stop(),
cli::DockerCompose::Up => scripts::docker_compose::up(),
},
cli::Commands::Dj { command } => match command {
cli::Django::MakeCommand { app, command } => {
scripts::django::make_command(&app, &command)
}
cli::Django::Makemigrations => scripts::django::makemigrations(),
cli::Django::Manage { rest } => scripts::django::manage(&rest),
cli::Django::Migrate => scripts::django::migrate(),
cli::Django::Shell => scripts::django::shell(),
},
cli::Commands::Pg { command } => match command {
cli::Postgres::Import { path } => scripts::postgres::import(&path),
cli::Postgres::Dump { path } => scripts::postgres::dump(&path),
},
};
Ok(())
}