Skip to content

Commit

Permalink
Casing fix #42
Browse files Browse the repository at this point in the history
  • Loading branch information
kpob committed Jun 25, 2024
1 parent 13ecc48 commit d3e7a29
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions src/actions/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ use crate::{
command::{rename_file, replace_in_file},
consts::{ODRA_TEMPLATE_GH_RAW_REPO, ODRA_TEMPLATE_GH_REPO},
errors::Error,
log,
paths,
log, paths,
project::OdraLocation,
template::TemplateGenerator,
utils::odra_latest_version,
};

/// InitAction configuration.
#[derive(Clone)]
pub struct InitAction {}
pub struct InitAction;

/// InitAction implementation.
impl InitAction {
Expand Down Expand Up @@ -74,7 +73,7 @@ impl InitAction {
},
};

cargo_generate::generate(GenerateArgs {
let project_path = cargo_generate::generate(GenerateArgs {
template_path,
list_favorites: false,
name: Some(paths::to_snake_case(&init_command.name)),
Expand All @@ -100,19 +99,14 @@ impl InitAction {
Error::FailedToGenerateProjectFromTemplate(e.to_string()).print_and_die();
});

let cargo_toml_path = match init {
true => {
let mut path = current_dir;
path.push("_Cargo.toml");
path
}
false => {
let mut path = current_dir;
path.push(paths::to_snake_case(&init_command.name));
path.push("_Cargo.toml");
path
}
};
let project_name = init_command.name.to_lowercase();
rename_file(project_path, &project_name);

let mut cargo_toml_path = current_dir;
if !init {
cargo_toml_path.push(project_name);
}
cargo_toml_path.push("_Cargo.toml");

Self::replace_package_placeholder(
init,
Expand Down

0 comments on commit d3e7a29

Please sign in to comment.