2017-06-19 03:16:32 -07:00
|
|
|
#!/usr/bin/julia
|
|
|
|
|
|
|
|
|
|
|
|
function check_dir(directory)
|
|
|
|
|
|
|
|
if ispath(directory)
|
|
|
|
print("The directory: ", directory, " :already exists\n")
|
|
|
|
return true
|
|
|
|
|
|
|
|
else
|
|
|
|
print("The directory: ", directory, " :does not exist\n")
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
function create_default_structure(projectDir)
|
|
|
|
|
|
|
|
subDirs = ["src", "lib"]
|
|
|
|
for dirs in subDirs
|
|
|
|
|
|
|
|
mkpath("$projectDir/$dirs")
|
|
|
|
end
|
2017-06-19 03:20:04 -07:00
|
|
|
|
2017-06-19 04:42:21 -07:00
|
|
|
|
|
|
|
projectName = rsearchindex(projectDir, "/" )
|
|
|
|
|
|
|
|
print(projectName, "\n")
|
|
|
|
projectName = projectDir[projectName+1:length(projectDir)]
|
|
|
|
|
|
|
|
|
|
|
|
touch("$projectDir/src/$projectName.jl")
|
2017-06-19 03:20:04 -07:00
|
|
|
touch("$projectDir/README.md")
|
|
|
|
touch("$projectDir/LICENSE")
|
2017-06-19 03:16:32 -07:00
|
|
|
end
|
|
|
|
|
2017-06-19 04:42:21 -07:00
|
|
|
|
|
|
|
|
2017-06-19 03:16:32 -07:00
|
|
|
function help()
|
|
|
|
print("This will be help\n")
|
|
|
|
end
|
|
|
|
|
|
|
|
function main()
|
|
|
|
|
|
|
|
if (length(ARGS) == 2 && ARGS[1] == "init")
|
|
|
|
|
|
|
|
print(length(ARGS), "\n")
|
|
|
|
|
|
|
|
if check_dir(ARGS[2]) == true
|
|
|
|
print("Dir exists")
|
|
|
|
|
|
|
|
else
|
|
|
|
create_default_structure(ARGS[2])
|
|
|
|
if check_dir(ARGS[2]) == true
|
|
|
|
print("Directory: ", ARGS[2], " created\n")
|
|
|
|
else
|
|
|
|
print("The directory: ", ARGS[2], " could not be created\n")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
help()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
main()
|