feat: rename commands and remove aliases in favour of completion
BREAKING CHANGE: changed commands as follows D -> Docker Dc -> Compose Dj -> Django Pg -> Postgres
This commit is contained in:
parent
61e7556997
commit
de5e6b4d10
|
@ -19,25 +19,25 @@ pub enum Commands {
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Docker related subcommands
|
/// Docker related subcommands
|
||||||
D {
|
Docker {
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Docker,
|
command: Docker,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Docker compose related subcommands
|
/// Docker compose related subcommands
|
||||||
Dc {
|
Compose {
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: DockerCompose,
|
command: DockerCompose,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Docker compose related subcommands
|
/// Docker compose related subcommands
|
||||||
Dj {
|
Django {
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Django,
|
command: Django,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Postgres related subcommands
|
/// Postgres related subcommands
|
||||||
Pg {
|
Postgres {
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Postgres,
|
command: Postgres,
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,7 +7,6 @@ use clap::Parser;
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
pub enum Django {
|
pub enum Django {
|
||||||
/// Prepare empty management command 'command' in app 'app'.
|
/// Prepare empty management command 'command' in app 'app'.
|
||||||
#[clap(alias("mc"))]
|
|
||||||
MakeCommand {
|
MakeCommand {
|
||||||
#[arg(value_enum)]
|
#[arg(value_enum)]
|
||||||
app: PathBuf,
|
app: PathBuf,
|
||||||
|
@ -16,24 +15,20 @@ pub enum Django {
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Run Django's manage.py makemigrations.
|
/// Run Django's manage.py makemigrations.
|
||||||
#[clap(alias("mm"))]
|
|
||||||
Makemigrations,
|
Makemigrations,
|
||||||
|
|
||||||
/// Pass arguments to Django's manage.py.
|
/// Pass arguments to Django's manage.py.
|
||||||
#[clap(alias("m"))]
|
|
||||||
Manage {
|
Manage {
|
||||||
#[arg(value_enum)]
|
#[arg(value_enum)]
|
||||||
rest: Vec<String>,
|
rest: Vec<String>,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Run Django's manage.py migrate.
|
/// Run Django's manage.py migrate.
|
||||||
#[clap(alias("mg"))]
|
|
||||||
Migrate {
|
Migrate {
|
||||||
#[arg(value_enum)]
|
#[arg(value_enum)]
|
||||||
rest: Vec<String>,
|
rest: Vec<String>,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Run Django's manage.py shell.
|
/// Run Django's manage.py shell.
|
||||||
#[clap(alias("s"))]
|
|
||||||
Shell,
|
Shell,
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,5 @@ use clap::Parser;
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
pub enum Docker {
|
pub enum Docker {
|
||||||
/// Stop all containers via `docker stop $(docker ps -q)`
|
/// Stop all containers via `docker stop $(docker ps -q)`
|
||||||
#[clap(alias("sa"))]
|
|
||||||
StopAll,
|
StopAll,
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,30 +6,23 @@ use clap::Subcommand;
|
||||||
#[derive(Subcommand, Debug)]
|
#[derive(Subcommand, Debug)]
|
||||||
pub enum DockerCompose {
|
pub enum DockerCompose {
|
||||||
/// Build containers.
|
/// Build containers.
|
||||||
#[clap(alias("b"))]
|
|
||||||
Build,
|
Build,
|
||||||
|
|
||||||
/// Down containers.
|
/// Down containers.
|
||||||
#[clap(alias("d"))]
|
|
||||||
Down,
|
Down,
|
||||||
|
|
||||||
/// Stop, build and start containers.
|
/// Stop, build and start containers.
|
||||||
#[clap(alias("rb"))]
|
|
||||||
Rebuild,
|
Rebuild,
|
||||||
|
|
||||||
/// Stop and start containers.
|
/// Stop and start containers.
|
||||||
#[clap(alias("rs"))]
|
|
||||||
Restart,
|
Restart,
|
||||||
|
|
||||||
/// Start containers.
|
/// Start containers.
|
||||||
#[clap(alias("st"))]
|
|
||||||
Start,
|
Start,
|
||||||
|
|
||||||
/// Stop containers.
|
/// Stop containers.
|
||||||
#[clap(alias("s"))]
|
|
||||||
Stop,
|
Stop,
|
||||||
|
|
||||||
/// Up containers.
|
/// Up containers.
|
||||||
#[clap(alias("u"))]
|
|
||||||
Up,
|
Up,
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,12 @@ use clap::Subcommand;
|
||||||
#[derive(Subcommand, Debug)]
|
#[derive(Subcommand, Debug)]
|
||||||
pub enum Postgres {
|
pub enum Postgres {
|
||||||
/// Import dump via pg_restore
|
/// Import dump via pg_restore
|
||||||
#[clap(alias("i"))]
|
|
||||||
Import {
|
Import {
|
||||||
#[arg(value_enum)]
|
#[arg(value_enum)]
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Dump via pg_dump with format=c
|
/// Dump via pg_dump with format=c
|
||||||
#[clap(alias("d"))]
|
|
||||||
Dump {
|
Dump {
|
||||||
#[arg(value_enum)]
|
#[arg(value_enum)]
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
|
|
|
@ -22,10 +22,10 @@ fn main() -> Result<()> {
|
||||||
);
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
cli::Commands::D { command } => match command {
|
cli::Commands::Docker { command } => match command {
|
||||||
cli::Docker::StopAll => scripts::docker::stop_all(),
|
cli::Docker::StopAll => scripts::docker::stop_all(),
|
||||||
},
|
},
|
||||||
cli::Commands::Dc { command } => match command {
|
cli::Commands::Compose { command } => match command {
|
||||||
cli::DockerCompose::Build => scripts::docker_compose::build(),
|
cli::DockerCompose::Build => scripts::docker_compose::build(),
|
||||||
cli::DockerCompose::Down => scripts::docker_compose::down(),
|
cli::DockerCompose::Down => scripts::docker_compose::down(),
|
||||||
cli::DockerCompose::Rebuild => scripts::docker_compose::rebuild(),
|
cli::DockerCompose::Rebuild => scripts::docker_compose::rebuild(),
|
||||||
|
@ -34,14 +34,14 @@ fn main() -> Result<()> {
|
||||||
cli::DockerCompose::Stop => scripts::docker_compose::stop(),
|
cli::DockerCompose::Stop => scripts::docker_compose::stop(),
|
||||||
cli::DockerCompose::Up => scripts::docker_compose::up(),
|
cli::DockerCompose::Up => scripts::docker_compose::up(),
|
||||||
},
|
},
|
||||||
cli::Commands::Dj { command } => match command {
|
cli::Commands::Django { command } => match command {
|
||||||
cli::Django::MakeCommand { app, name } => scripts::django::make_command(&app, &name),
|
cli::Django::MakeCommand { app, name } => scripts::django::make_command(&app, &name),
|
||||||
cli::Django::Makemigrations => scripts::django::makemigrations(),
|
cli::Django::Makemigrations => scripts::django::makemigrations(),
|
||||||
cli::Django::Manage { rest } => scripts::django::manage(&rest),
|
cli::Django::Manage { rest } => scripts::django::manage(&rest),
|
||||||
cli::Django::Migrate { rest } => scripts::django::migrate(&rest),
|
cli::Django::Migrate { rest } => scripts::django::migrate(&rest),
|
||||||
cli::Django::Shell => scripts::django::shell(),
|
cli::Django::Shell => scripts::django::shell(),
|
||||||
},
|
},
|
||||||
cli::Commands::Pg { command } => match command {
|
cli::Commands::Postgres { command } => match command {
|
||||||
cli::Postgres::Import { path } => scripts::postgres::import(&path),
|
cli::Postgres::Import { path } => scripts::postgres::import(&path),
|
||||||
cli::Postgres::Dump { path } => scripts::postgres::dump(&path),
|
cli::Postgres::Dump { path } => scripts::postgres::dump(&path),
|
||||||
},
|
},
|
||||||
|
|
|
@ -68,4 +68,3 @@ pub fn migrate(rest: &[String]) -> Result<()> {
|
||||||
|
|
||||||
manage(&full_rest)
|
manage(&full_rest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue