Skip to content

Commit 3837583

Browse files
authored
Remove duplicate --help message for unknown argument (#115)
The `err` function already appends a hint about --help so this patch removes the duplication for the case of unknown arguments. Also appends a dot to other errors since the --help hint starts as a new sentence.
1 parent b8da192 commit 3837583

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ function get_package_name_from_project_toml(path)
2121
elseif isfile(joinpath(path, "Project.toml"))
2222
project_path = joinpath(path, "Project.toml")
2323
else
24-
return err("No `Project.toml` file found at $path or $(joinpath(path, "Project.toml"))")
24+
return err("No `Project.toml` file found at $path or $(joinpath(path, "Project.toml")).")
2525
end
2626
project = parsefile(project_path)
2727
if !haskey(project, "name")
28-
return err("`Project.toml` does not have `name` entry; does not correspond to valid Julia package")
28+
return err("`Project.toml` does not have `name` entry; does not correspond to valid Julia package.")
2929
end
3030
package = Symbol(project["name"])
3131
return package, project_path
@@ -177,7 +177,7 @@ function main(args)
177177
elseif x == "--checklist"
178178
should_run_checks = true # Automatically imply --check
179179
if length(args) == 0
180-
return err("Argument `--checklist` requires a value")
180+
return err("Argument `--checklist` requires a value.")
181181
end
182182
values = split(popfirst!(args), ",")
183183
# If any of passed checks is not an exclude, then starts with an empty list
@@ -187,7 +187,7 @@ function main(args)
187187
for value in values
188188
unique!(selected_checks)
189189
if !(value in valid_check_values)
190-
return err("Invalid check passed to --checklist: $value")
190+
return err("Invalid check passed to --checklist: $value.")
191191
end
192192
if value == "all"
193193
selected_checks = copy(CHECKS)
@@ -196,7 +196,7 @@ function main(args)
196196
elseif startswith(EXCLUDE_PREFIX)(value)
197197
check = value[(1 + length(EXCLUDE_PREFIX)):end]
198198
if !(check in CHECKS)
199-
return err("Check $check is not part of the valid checks, so it can't be excluded")
199+
return err("Check $check is not part of the valid checks, so it can't be excluded.")
200200
end
201201
i = findfirst(selected_checks .== check)
202202
if !isnothing(i)
@@ -211,7 +211,7 @@ function main(args)
211211
path = abspath(x)
212212
else
213213
# Unknown argument
214-
return err("Argument `$x` is not a supported flag, directory, or file. See the output of `--help` for usage details")
214+
return err("Argument `$x` is not a supported flag, directory, or file.")
215215
end
216216
end
217217
end
@@ -239,7 +239,7 @@ function main(args)
239239
end
240240
if should_run_checks
241241
if length(selected_checks) == 0
242-
return err("The passed combination of checks $values made the selection empty")
242+
return err("The passed combination of checks $values made the selection empty.")
243243
end
244244
return run_checks(package, selected_checks)
245245
end

0 commit comments

Comments
 (0)