mirror of
https://github.com/SangeloDev/niminit.git
synced 2024-11-22 16:32:40 +00:00
more git init repo setup
This commit is contained in:
parent
270c4cccfe
commit
7ebf0298b1
1 changed files with 23 additions and 1 deletions
24
niminit.nim
24
niminit.nim
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import strutils
|
import strutils
|
||||||
|
import strformat
|
||||||
|
|
||||||
var count = 0
|
var count = 0
|
||||||
for entry in walkDir("."):
|
for entry in walkDir("."):
|
||||||
|
@ -54,7 +55,28 @@ else:
|
||||||
if "-g" in (commandLineParams()):
|
if "-g" in (commandLineParams()):
|
||||||
let createdRepo = execShellCmd("git init")
|
let createdRepo = execShellCmd("git init")
|
||||||
if createdRepo == 0:
|
if createdRepo == 0:
|
||||||
echo "Successfully created local git repository!"
|
echo "Successfully initialised local git repository!"
|
||||||
|
echo "Would you like to configure it? [Y/n]"
|
||||||
|
var input = stdin.readLine()
|
||||||
|
case input.toLower
|
||||||
|
of "yes", "y", "z", "j", "":
|
||||||
|
echo "Enter the git remote:"
|
||||||
|
let gitRemote = stdin.readLine()
|
||||||
|
echo "Enter your desired branch name:"
|
||||||
|
let gitBranch = stdin.readLine()
|
||||||
|
echo "Setting values..."
|
||||||
|
let setupGitRepo = execShellCmd(&"git remote add origin {gitRemote}")
|
||||||
|
let setGitBranch = execShellCmd(&"git branch -m {gitBranch}")
|
||||||
|
if setupGitRepo == 0:
|
||||||
|
echo &"Successfully added remote {gitRemote}"
|
||||||
|
else:
|
||||||
|
echo &"Failed to add remote {gitRemote}"
|
||||||
|
if setGitBranch == 0:
|
||||||
|
echo &"Successfully set branch to {gitBranch}"
|
||||||
|
else:
|
||||||
|
echo &"Failed to set branch {gitBranch}"
|
||||||
|
else:
|
||||||
|
echo "Successfully created local git repository!"
|
||||||
else:
|
else:
|
||||||
echo: "Failed creating local git repository."
|
echo: "Failed creating local git repository."
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue