Actually invert the init flag

This commit is contained in:
2024-07-20 19:51:33 +02:00
parent e9b6788af6
commit 7090618dbd

View File

@@ -66,11 +66,13 @@ func main() {
} }
var name string var name string
var private, forceInit bool var private, noinit, forceInit bool
flag.StringVar(&name, "name", "", "Name of the repository") flag.StringVar(&name, "name", "", "Name of the repository")
flag.StringVar(&name, "n", "", "Name of the repository (shorthand)") flag.StringVar(&name, "n", "", "Name of the repository (shorthand)")
flag.BoolVar(&private, "private", false, "Make the repository private") flag.BoolVar(&private, "private", false, "Make the repository private")
flag.BoolVar(&private, "p", false, "Make the repository private (shorthand)") flag.BoolVar(&private, "p", false, "Make the repository private (shorthand)")
flag.BoolVar(&noinit, "noinit", false, "Do not add remote to the new repo")
flag.BoolVar(&noinit, "ni", false, "Do not add remote to the new repo (shorthand)")
flag.BoolVar(&forceInit, "f", false, "Force assignment of the remote (deletes existing origin)") flag.BoolVar(&forceInit, "f", false, "Force assignment of the remote (deletes existing origin)")
flag.Parse() flag.Parse()
@@ -108,6 +110,7 @@ func main() {
clipboard.Write(clipboard.FmtText, []byte(repo.CloneURL)) clipboard.Write(clipboard.FmtText, []byte(repo.CloneURL))
} }
if !noinit {
cwd, err := os.Getwd() cwd, err := os.Getwd()
if err != nil { if err != nil {
Error.Fatalf("Error getting current working directory: %v", err) Error.Fatalf("Error getting current working directory: %v", err)
@@ -153,4 +156,5 @@ func main() {
os.Exit(1) os.Exit(1)
} }
log.Printf("Remote added to local repository") log.Printf("Remote added to local repository")
}
} }