refactor: put every filesystem write behind one module
This commit is contained in:
@@ -4,12 +4,15 @@ mod cli;
|
||||
mod cmd;
|
||||
mod compose;
|
||||
mod ctx;
|
||||
mod fsops;
|
||||
mod output;
|
||||
mod scripts;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
|
||||
use crate::ctx::Ctx;
|
||||
use crate::output::note;
|
||||
|
||||
fn main() -> ExitCode {
|
||||
let args = cli::Ahab::parse();
|
||||
@@ -19,8 +22,10 @@ fn main() -> ExitCode {
|
||||
dry_run: args.dry_run,
|
||||
};
|
||||
|
||||
// said once here rather than by each command, so every line that follows
|
||||
// reads as the plan it is
|
||||
if ctx.dry_run {
|
||||
cli::reject_unsupported_dry_run(&args.command);
|
||||
note!("dry run, nothing will be changed");
|
||||
}
|
||||
|
||||
match run(&ctx, args.command) {
|
||||
@@ -41,7 +46,7 @@ fn run(ctx: &Ctx, command: cli::Commands) -> Result<ExitCode> {
|
||||
cli::Django::Bash => scripts::django::bash(ctx),
|
||||
cli::Django::Run { rest } => scripts::django::run(ctx, &rest),
|
||||
cli::Django::MakeCommand { app, name } => {
|
||||
scripts::django::make_command(&app, &name)
|
||||
scripts::django::make_command(ctx, &app, &name)
|
||||
}
|
||||
cli::Django::Makemigrations => scripts::django::makemigrations(ctx),
|
||||
cli::Django::Manage { rest } => scripts::django::manage(ctx, &rest),
|
||||
|
||||
Reference in New Issue
Block a user