Skip to content

Commit

Permalink
Add set up script
Browse files Browse the repository at this point in the history
  • Loading branch information
jaguililla committed Sep 30, 2024
1 parent bec901d commit 7389d3f
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions set_up.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
///usr/bin/env java --enable-preview --source 21 -cp "*" "$0" "$@" ; exit $?

import static java.util.Map.entry;

import java.io.Console;
import java.util.List;

private Console console = System.console();

void main() {
System.out.println("Set up project");
// Ask to keep Git hosting files
// Ask to keep extra documents
// Ask to keep this file
var options = List.of(
entry("GitHub", prompt("Keep GitHub workflows and templates: (Yn)", "y")),
entry("GitLab", prompt("Keep GitLab workflows and templates: (Yn)", "y")),
entry("GitLab", prompt("Keep 'CODE_OF_CONDUCT.md' file: (Yn)", "y")),
entry("GitLab", prompt("Keep 'CONTRIBUTING.md' file: (Yn)", "y")),
entry("GitLab", prompt("Keep 'LICENSE.md' file: (Yn)", "y")),
entry("GitLab", prompt("Keep this set up file 'set_up.java' file: (Yn)", "y"))
);

// Rename artifacts, groups or base package
// Restart Git history (or delete it)
}

public String prompt(String message, String defaultValue) {
console.printf(message);
var v = console.readLine();
return v == null || v.isBlank() ? defaultValue : v;
}

0 comments on commit 7389d3f

Please sign in to comment.