diff --git a/src/jprog.jl b/src/jprog.jl index 2084ef9..8811be8 100755 --- a/src/jprog.jl +++ b/src/jprog.jl @@ -49,7 +49,7 @@ end function create_default_structure(projectDir) - subDirs = ["src", "lib"] + local subDirs = ["src", "lib"] for dirs in subDirs mkpath("$projectDir/$dirs") @@ -65,14 +65,15 @@ function create_default_structure(projectDir) touch("$projectDir/src/$projectName.jl") touch("$projectDir/README.md") touch("$projectDir/LICENSE") - git_init("$projectDir") end function git_init(projectPath) LibGit2.init("$projectPath", false) # Initialize git repository - if check_dir("$projectPath/.git") == true - print("Initialized git repository in $projectPath\n") + if check_dir("$projectPath/.git") != true + print("Failed to initialize git repository in: ", pwd(), "/$projectPath\n") + else + print("Git repository initialized\n") end end @@ -88,20 +89,22 @@ function version() end function main() - + local projectName = ARGS[2] + if (length(ARGS) == 2 && ARGS[1] == "init") if DEBUG == true print("ARGS Count: ", length(ARGS), "\n") end - if check_dir(ARGS[2]) == true + if check_dir(projectName) == true if DEBUG == true print("Dir exists") end else - create_default_structure(ARGS[2]) - if check_dir(ARGS[2]) == true - print("Project: ", ARGS[2], " created\n") + create_default_structure(projectName) + if check_dir(projectName) == true + print("Project: '", projectName, "' was successfully created in: ", pwd(), "/$projectName\n") + git_init("$projectName") else - print("The directory: ", ARGS[2], " could not be created\n") + print("The directory: '", projectName, "' could not be created\n") end end