indent to line with module block
This commit is contained in:
parent
8ea5db169a
commit
4189916925
128
lib/libjprog.jl
128
lib/libjprog.jl
@ -11,85 +11,85 @@ module LibJprog
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
DEBUG = false # enable for verbose messages
|
DEBUG = false # enable for verbose messages
|
||||||
|
|
||||||
# Generic directory checking with boolean returns
|
# Generic directory checking with boolean returns
|
||||||
function check_dir(directory)
|
function check_dir(directory)
|
||||||
|
|
||||||
if ispath(directory)
|
if ispath(directory)
|
||||||
if DEBUG == true print("The directory: ", directory, " already exists\n") end
|
if DEBUG == true print("The directory: ", directory, " already exists\n") end
|
||||||
return true
|
return true
|
||||||
|
|
||||||
else
|
else
|
||||||
if DEBUG == true print("The directory: ", directory, " does not exist\n") end
|
if DEBUG == true print("The directory: ", directory, " does not exist\n") end
|
||||||
return false
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Generic file checking with boolean returns
|
||||||
|
function check_file(filePath)
|
||||||
|
|
||||||
end
|
if isfile(filePath)
|
||||||
|
|
||||||
|
if DEBUG == true print("File: ", filePath, " exists\n") end
|
||||||
|
return true
|
||||||
|
|
||||||
# Generic file checking with boolean returns
|
else
|
||||||
function check_file(filePath)
|
if DEBUG == false print("File: ", filePath, " does not exist\n") end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if isfile(filePath)
|
# Somewhat automate creating directories
|
||||||
|
function create_default_structure(projectDir)
|
||||||
|
|
||||||
if DEBUG == true print("File: ", filePath, " exists\n") end
|
local subDirs = ["src", "lib"]
|
||||||
return true
|
for dirs in subDirs
|
||||||
|
|
||||||
else
|
mkpath("$projectDir/$dirs")
|
||||||
if DEBUG == false print("File: ", filePath, " does not exist\n") end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Somewhat automate creating directories
|
|
||||||
function create_default_structure(projectDir)
|
|
||||||
|
|
||||||
local subDirs = ["src", "lib"]
|
|
||||||
for dirs in subDirs
|
|
||||||
|
|
||||||
mkpath("$projectDir/$dirs")
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
# check whether projectDir contains /
|
|
||||||
projectName = occursin(projectDir, "/" )
|
|
||||||
|
|
||||||
if DEBUG == true print(projectName, "\n") end
|
|
||||||
|
|
||||||
# append name of project to main source file name
|
|
||||||
projectName = projectDir[projectName+1:length(projectDir)]
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
touch("$projectDir/src/$projectName.jl")
|
# check whether projectDir contains /
|
||||||
touch("$projectDir/README.md")
|
projectName = occursin(projectDir, "/" )
|
||||||
touch("$projectDir/LICENSE")
|
|
||||||
end
|
|
||||||
|
|
||||||
# Establish a Git repository in project root
|
if DEBUG == true print(projectName, "\n") end
|
||||||
function git_init(projectPath)
|
|
||||||
|
# append name of project to main source file name
|
||||||
|
projectName = projectDir[projectName+1:length(projectDir)]
|
||||||
|
|
||||||
|
|
||||||
init("$projectPath", false)
|
touch("$projectDir/src/$projectName.jl")
|
||||||
|
touch("$projectDir/README.md")
|
||||||
if check_dir("$projectPath/.git") != true
|
touch("$projectDir/LICENSE")
|
||||||
|
|
||||||
print("Failed to initialize git repository in: ", pwd(), "/$projectPath\n")
|
|
||||||
|
|
||||||
else
|
|
||||||
print("Git repository initialized\n")
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# Print a list of supported commands
|
# Establish a Git repository in project root
|
||||||
function help()
|
function git_init(projectPath)
|
||||||
print("\n", "useage: jprog init <project name>", "\n", "\n")
|
|
||||||
|
|
||||||
print("init Create a new project\n")
|
|
||||||
end
|
|
||||||
|
|
||||||
# Get version information for this program
|
init("$projectPath", false)
|
||||||
function version()
|
|
||||||
|
if check_dir("$projectPath/.git") != true
|
||||||
|
|
||||||
|
print("Failed to initialize git repository in: ", pwd(), "/$projectPath\n")
|
||||||
|
|
||||||
print("\n", "Version 1\n\n")
|
else
|
||||||
end
|
print("Git repository initialized\n")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Print a list of supported commands
|
||||||
|
function help()
|
||||||
|
print("\n", "useage: jprog init <project name>", "\n", "\n")
|
||||||
|
|
||||||
|
print("init Create a new project\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
# Get version information for this program
|
||||||
|
function version()
|
||||||
|
|
||||||
|
print("\n", "Version 1\n\n")
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user