Skip to content

Commit

Permalink
Format .jl files
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 29, 2020
1 parent 21d9c94 commit 5d22bcd
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ makedocs(;
"Command Types" => "types.md",
"Command Parsing" => "parse.md",
"Code Generation" => "codegen.md",
"Build and Install CLI" => "build.md"
"Build and Install CLI" => "build.md",
],
repo = "https://github.com/Roger-luo/Comonicon.jl",
sitename = "Comonicon.jl",
Expand Down
2 changes: 1 addition & 1 deletion example/myscript.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ my command line interface.
- `-f, --flag`: a flag that has short flag.
"""
@main function mycmd(arg; option="Sam", flag::Bool=false)
@main function mycmd(arg; option = "Sam", flag::Bool = false)
@show arg
@show option
@show flag
Expand Down
45 changes: 23 additions & 22 deletions src/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,16 @@ function install(
)

if sysimg
build(mod, name;
sysimg_path=sysimg_path,
incremental=incremental,
compile=compile,
filter_stdlibs=filter_stdlibs,
lib_path=lib_path,
cpu_target=cpu_target,
optimize=optimize
build(
mod,
name;
sysimg_path = sysimg_path,
incremental = incremental,
compile = compile,
filter_stdlibs = filter_stdlibs,
lib_path = lib_path,
cpu_target = cpu_target,
optimize = optimize,
)
end

Expand Down Expand Up @@ -219,17 +221,18 @@ end
Build system image for given CLI module. See also [`install`](@ref).
"""
function build(
mod, name=default_name(mod);
sysimg_path::String=PATH.sysimg(mod, name),
project::String = PATH.project(mod),
create_tarball::Bool = false,
incremental::Bool = false,
compile = nothing,
filter_stdlibs = false,
lib_path = PATH.project(mod, "deps", "lib"),
cpu_target = "native",
optimize = 2,
)
mod,
name = default_name(mod);
sysimg_path::String = PATH.sysimg(mod, name),
project::String = PATH.project(mod),
create_tarball::Bool = false,
incremental::Bool = false,
compile = nothing,
filter_stdlibs = false,
lib_path = PATH.project(mod, "deps", "lib"),
cpu_target = "native",
optimize = 2,
)

if !ispath(lib_path)
@info "creating library path: $lib_path"
Expand Down Expand Up @@ -257,9 +260,7 @@ function build(

if create_tarball
version = get_version(mod)
os = Sys.isapple() ? "darwin" :
Sys.islinux() ? "linux" :
error("unsupported OS")
os = Sys.isapple() ? "darwin" : Sys.islinux() ? "linux" : error("unsupported OS")

tarball = "$name-$VERSION-$os-$(Sys.ARCH).tar.gz"
@info "creating tarball $tarball"
Expand Down
8 changes: 4 additions & 4 deletions src/parse/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Return the files that will be cached:
1. `cmd.jl`: a julia script that contains the generated CLI code.
2. `checksum`: a checksum file for checking if the generated CLI code matches the original file.
"""
function cachefile(file=Base.PROGRAM_FILE)
function cachefile(file = Base.PROGRAM_FILE)
dir = cachedir(file)
return joinpath(dir, "cmd.jl"), joinpath(dir, "checksum")
end
Expand All @@ -66,7 +66,7 @@ end
Return the cache directory.
"""
function cachedir(file=Base.PROGRAM_FILE)
function cachedir(file = Base.PROGRAM_FILE)
name, _ = splitext(basename(file))
dir = joinpath(dirname(file), "." * name * ".cmd")
isabspath(file) || return joinpath(pwd(), dir)
Expand All @@ -78,7 +78,7 @@ end
Check if the given file is cached or not.
"""
function iscached(file=Base.PROGRAM_FILE)
function iscached(file = Base.PROGRAM_FILE)
cache_file, crc = cachefile(file)
isfile(crc) || return false
isfile(cache_file) || return false
Expand All @@ -104,7 +104,7 @@ end
Create cache for given command `cmd` at file location `file`.
"""
function create_cache(cmd, file=Base.PROGRAM_FILE)
function create_cache(cmd, file = Base.PROGRAM_FILE)
isempty(file) && return
dir = cachedir(file)
if !ispath(dir)
Expand Down
2 changes: 1 addition & 1 deletion test/parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ ArgParse example implemented in Comonicon.
@test opt2 == 2
end

Comonicon.install(Dummy; bin=Comonicon.PATH.project("test", "bin"))
Comonicon.install(Dummy; bin = Comonicon.PATH.project("test", "bin"))
@test isfile(Comonicon.PATH.project("test", "bin", "dummy"))
@test isfile(Comonicon.PATH.project("test", "bin", "dummy.jl"))

0 comments on commit 5d22bcd

Please sign in to comment.