Skip to content

Commit

Permalink
fix: print git remote adding instructions rather than automating them
Browse files Browse the repository at this point in the history
Unable to figure out for now how to work around 128 error code.
  • Loading branch information
gibbz00 committed Oct 5, 2024
1 parent 79c6b0b commit 1882638
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions cargo_generate/script.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,15 @@ if variable::is_set("ci") {
// WORKAROUND: CONTRIBUTING.md does for some reason not seem to be overwritten by a CONTRIBUTING.md.liquid
file::rename("CONTRIBUTING_FINAL.md", "CONTRIBUTING.md");


add_repository();
prompt_variable("repository_path", "Repository path (usually 'username/repository_name')");
template_license();
template_code_of_conduct();
template_security_policy();
template_precommit_hooks();
template_book();
prompt_optional_string("architecture_url", "Architecture README.md URL");
template_code_coverage();

fn add_repository() {
let repository_path = prompt_variable("repository_path", "Repository path (usually 'username/repository_name')");

let prefix = switch variable::prompt("Auto-add git remote url?", "no", ["https", "ssh", "no"]) {
"no" => { return; },
"ssh" => "https://github.com/",
"https" => "git@github.com:",
};

let remote = `${prefix}${repository_path}.git`;

system::command("git", [
"-c",
"user.name='temp'",
"-c",
"user.email='temp@temp.com'",
"remote", "add", "origin", remote
]);
}
print_adding_premote();

fn template_license() {
variable::set("year", system::date().year.to_string());
Expand Down Expand Up @@ -171,3 +151,15 @@ fn prompt_yes_no(name, prompt) {

value
}

fn print_adding_premote() {
let repository_path = variable::get("repository_path");

print("Remote git repository may finally be registered by running:");
print("");
print(`git remote add origin git@github.com:${repository_path}.git`);
print("");
print("or");
print("");
print(`git remote add origin https://github.com/${repository_path}.git`);
}

0 comments on commit 1882638

Please sign in to comment.