diff --git a/src/argsparsing.jl b/src/argsparsing.jl index 8112f2b..ac7fc4d 100644 --- a/src/argsparsing.jl +++ b/src/argsparsing.jl @@ -100,7 +100,7 @@ end Convert string to Number type with parse or other type with direct conversion. Quit program if s is nothing or conversion fails. """ -function _converttype!(::Type{T}, s::Union{AbstractString, Nothing}, name::String)::T where T +function _converttype!(::Type{T}, s::Union{String, Nothing}, name::String)::T where T if isnothing(s) _quit_try_help("Argument $name missing") end diff --git a/src/handleast.jl b/src/handleast.jl index a7ba079..bd562b4 100644 --- a/src/handleast.jl +++ b/src/handleast.jl @@ -15,8 +15,6 @@ Enforce argument declaration ordering: Throw `ArgumentError` if ordering violates this rule. """ function _validateorder(block::Expr) - encountered_description = false - encountered_argument = false encountered_positional = false encoundered_optional_positional = false @@ -26,30 +24,13 @@ function _validateorder(block::Expr) # Fix namespace issues macroname::Symbol = _get_macroname(arg) - if macroname == usage_symbol - if encountered_description || encountered_argument - throw(ArgumentError( - "Usage must be stated before description or arguments.\nFrom: $arg" - )) - end - elseif macroname == description_symbol - encountered_description = true - - if encountered_argument - throw(ArgumentError( - "Description must be stated before any arguments.\nFrom: $arg" - )) - end - elseif macroname in flagged_symbols - encountered_argument = true - + if macroname in flagged_symbols if encountered_positional throw(ArgumentError( "Positional arguments must be declared after all flagged arguments.\nFrom: $arg" )) end elseif macroname == positional_required_symbol - encountered_argument = true encountered_positional = true if encoundered_optional_positional @@ -58,7 +39,6 @@ function _validateorder(block::Expr) )) end elseif macroname in positional_optional_symbols - encountered_argument = true encountered_positional = true encoundered_optional_positional = true end diff --git a/src/macros.jl b/src/macros.jl index 0963526..832d12d 100644 --- a/src/macros.jl +++ b/src/macros.jl @@ -299,7 +299,7 @@ macro argtest(argname::Symbol, func::Union{Symbol, Expr}, desc::Union{String, No end """ - @allowextraargs + @allowextraarguments Disables the default behavior of printing a message and exiting the program when not all values in `ARGS` could be assigned to @@ -311,7 +311,7 @@ Must be used in `@beginarguments begin ... end` block ```julia @beginarguments begin ... - @allowextraargs + @allowextraarguments end ``` """