From 14be85e1244005c0f04d3830ea1ea5934cf4d7f6 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sat, 14 Feb 2026 16:45:53 -0600 Subject: [PATCH 1/9] fix: Add padding to base30 encoded values --- src/Base30.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Base30.jl b/src/Base30.jl index 9bc673e..98f4c00 100644 --- a/src/Base30.jl +++ b/src/Base30.jl @@ -46,7 +46,9 @@ julia> using UUIDs; base30encode(uuid1()) ``` """ function base30encode(v::Integer) - return String([BASE30_ALPHABET[i] for i in reverse(digits(v; base = 30) .+ 1)]) + return String([ + BASE30_ALPHABET[i] for i in reverse(digits(v; base = 30, pad = 29) .+ 1) + ]) end #function function base30encode(v::UUID) From 5c5deb9c893debf5affd0d3e52cde5135ddbe250 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sat, 14 Feb 2026 16:49:24 -0600 Subject: [PATCH 2/9] feat: Add CualerID conversion function --- src/CualerID.jl | 1 + src/Minting.jl | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/CualerID.jl b/src/CualerID.jl index 013a135..0780627 100644 --- a/src/CualerID.jl +++ b/src/CualerID.jl @@ -11,6 +11,7 @@ include("Minting.jl") export ResultCode export ResultCodeOption export base30encode +export cualer_id export has_duplicate export has_fixed export has_not_fixable diff --git a/src/Minting.jl b/src/Minting.jl index ede65d3..0270e13 100644 --- a/src/Minting.jl +++ b/src/Minting.jl @@ -9,3 +9,15 @@ function _hamming(str1::AbstractString, str2::AbstractString) throw(DimensionMismatch("strings must be of equal length")) return sum(c -> first(c) != last(c), zip(str1, str2)) end #function + +""" + cualer_id(u::UUID; length::Integer = 29) + +Convert `u` to a base30 CualerID, truncating all but the last `length` digits as +the human-readable representation of `u` +""" +function cualer_id(u::UUID; length::Integer = 29) + length > 29 && + throw(BoundsError("CualerIDs cannot be printed at lengths longer than 29")) + return base30encode(u)[(end-(length-1)):end] +end #function From 086d1442e630cbcc57b6b100cdf344615d78b4c1 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sat, 14 Feb 2026 16:50:56 -0600 Subject: [PATCH 3/9] feat: Add mint_ids! function --- src/CualerID.jl | 3 +- src/Minting.jl | 87 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/src/CualerID.jl b/src/CualerID.jl index 0780627..a1b67cf 100644 --- a/src/CualerID.jl +++ b/src/CualerID.jl @@ -2,7 +2,7 @@ module CualerID using ArgParse: ArgParse, ArgParseSettings, parse_args, parse_item, @add_arg_table! using FilePathsBase: AbstractPath, Path, exists, isfile -using UUIDs: UUID +using UUIDs: UUID, uuid4 include("Base30.jl") include("ResultCodeOption.jl") @@ -16,6 +16,7 @@ export has_duplicate export has_fixed export has_not_fixable export has_valid +export mint_ids! function _create_arg_table() s = ArgParseSettings(autofix_names = true) diff --git a/src/Minting.jl b/src/Minting.jl index 0270e13..e6613c2 100644 --- a/src/Minting.jl +++ b/src/Minting.jl @@ -21,3 +21,90 @@ function cualer_id(u::UUID; length::Integer = 29) throw(BoundsError("CualerIDs cannot be printed at lengths longer than 29")) return base30encode(u)[(end-(length-1)):end] end #function + +""" + mint_ids!( + [existing_ids::Vector{UUID}], + desired_total::Integer, + desired_length::Integer, + failure_threshold::AbstractFloat, + ) + +Creates `desired_total` number of `UUID`s that are valid CualerIDs at a `desired_length` + +# Arguments +- `existing_ids::Vector{UUID}`: A set of existing CualerIDs that have already been + validated. The default is an empty array, i.e. construct an entirely new set of CualerIDs. +- `desired_total::Integer`: The length to grow `existing_ids` to +- `desired_length::Integer`: The length of the CualerID string that is compared to check for + conflicts +- `failure_threshold::AbstractFloat`: The fraction of non-conflicting values (between 0 and + 1) that is required +""" +function mint_ids!( + existing_ids::Vector{UUID}, + desired_total::Integer, + desired_length::Integer, + failure_threshold::AbstractFloat, +) + # Exception to my recent thirst for "parse, don't validate" + # We could technically make failure_threshold a `Normed{T,f}` value from + # FixedPointNumbers.jl, but that would + # a) Require taking a dependency on FixedPointNumbers.jl + # b) Require all dependents to also depend on FixedPointNumbers.jl in order to + # properly call this function + if failure_threshold < 0 || failure_threshold > 1 + throw( + DomainError( + failure_threshold, + "`failure_threshold` must be between 0.0 and 1.0", + ), + ) + end #if + + # Strategy to grow the vector: + # a) Check how many elements are needed + # b) Add unvalidated elements + # c) Validate new elements against all elements up to itself + # d) Delete invalid elements + # e) Repeat + existing_length = length(existing_ids) + needed_to_fill = desired_total - existing_length + failed_ids = Int[] + + push!(existing_ids, [uuid4() for i = 1:needed_to_fill]...) + + for i = (existing_length+1):desired_total + for j = 1:(i-1) + if _hamming( + cualer_id(existing_ids[i]; length = desired_length), + cualer_id(existing_ids[j], length = desired_length), + ) < 3 + push!(failed_ids, i) + @debug """ + Conflict found between + $(existing_ids[i]) ($(cualer_id(existing_ids[i]))) + and + $(existing_ids[j]) ($(cualer_id(existing_ids[i]))) + """ + break + end #if + end #for + end #for + + if 1 - length(failed_ids) / desired_total > failure_threshold + return existing_ids + else + return mint_ids!(existing_ids, desired_total, desired_length, failure_threshold) + end #if +end #function + + +function mint_ids!( + desired_total::Integer, + desired_length::Integer, + failure_threshold::AbstractFloat, +) + return mint_ids!(UUID[], desired_total, desired_length, failure_threshold) + +end #function From 9e2de1c71e62b8f646f48f69ef83da6fe4ec5ba0 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sat, 14 Feb 2026 17:13:40 -0600 Subject: [PATCH 4/9] docs: Add badges to README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 8bacf03..ab248ba 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # CualerID +[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://millironx.com/CualerID.jl/stable) +[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://millironx.com/CualerID.jl/dev) +[![status-badge](https://woodpecker.millironx.com/api/badges/31/status.svg)](https://woodpecker.millironx.com/repos/31) [![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle) [![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl) From 0304fa79aa1a3d8e353f751081d202cca4588beb Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sat, 14 Feb 2026 17:14:46 -0600 Subject: [PATCH 5/9] feat: Implement id generation --- src/CualerID.jl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/CualerID.jl b/src/CualerID.jl index a1b67cf..5a4b58e 100644 --- a/src/CualerID.jl +++ b/src/CualerID.jl @@ -49,7 +49,7 @@ function _create_arg_table() arg_type = UInt64 default = UInt64(5) "--fail-threshold", "-f" - help = "NOT IMPLEMENTED: The rate at which similar ids will fail the process" + help = "The fraction of ids which must be dissimilar" arg_type = Float64 range_tester = x -> x >= 0 && x <= 1.0 default = 0.99 @@ -123,10 +123,13 @@ function _create(parsed_args::Dict{Symbol,Any}) end #function function _create_ids(parsed_args::Dict{Symbol,Any}) - println("COMMAND:\tcreate ids") - for (key, val) in parsed_args - println("\t$key:\t$val") - end #function + ids = mint_ids!( + parsed_args[:number_of_ids], + parsed_args[:length], + parsed_args[:fail_threshold], + ) + + foreach(i -> println(i, '\t', cualer_id(i; length = parsed_args[:length])), ids) return 0 end #function From 8918ca4e95db7336a12df18654b804767e697f0a Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sat, 7 Nov 2026 10:47:49 -0600 Subject: [PATCH 6/9] deps: Add OptParse --- Project.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Project.toml b/Project.toml index 77d2f10..9b2f8f1 100644 --- a/Project.toml +++ b/Project.toml @@ -6,11 +6,13 @@ authors = ["Thomas A. Christensen II <25492070+MillironX@users.noreply.github.co [deps] ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63" FilePathsBase = "48062228-2e41-5def-b9a4-89aafe57970f" +OptParse = "1244ff17-1aa7-4121-9347-f4ead108e58f" UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [compat] ArgParse = "1.2.0" FilePathsBase = "0.9.24" +OptParse = "0.4.3" UUIDs = "1.11.0" julia = "1.12" From 1b2d6d26a7ba76ce04c451a3dd4e5f6d1034b523 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sat, 7 Nov 2026 10:49:33 -0600 Subject: [PATCH 7/9] feat: Add ResultCodeOptionValueParser --- src/CualerID.jl | 1 + src/ResultCodeOptionValueParser.jl | 46 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/ResultCodeOptionValueParser.jl diff --git a/src/CualerID.jl b/src/CualerID.jl index 5a4b58e..20581c1 100644 --- a/src/CualerID.jl +++ b/src/CualerID.jl @@ -2,6 +2,7 @@ module CualerID using ArgParse: ArgParse, ArgParseSettings, parse_args, parse_item, @add_arg_table! using FilePathsBase: AbstractPath, Path, exists, isfile +using OptParse: OptParse using UUIDs: UUID, uuid4 include("Base30.jl") diff --git a/src/ResultCodeOptionValueParser.jl b/src/ResultCodeOptionValueParser.jl new file mode 100644 index 0000000..6f48367 --- /dev/null +++ b/src/ResultCodeOptionValueParser.jl @@ -0,0 +1,46 @@ +@enum ResultCodeOptionErrCode::UInt8 begin + RESULTCODEOPTION_InvalidOption + RESULTCODEOPTION_NoOptions +end #@enum + +struct ResultCodeOptionError <: OptParse.AbstractParseError + code::ResultCodeOptionErrCode + token::String +end #struct + +function OptParse.render_error(io::IO, err::ResultCodeOptionError) + return if err.code == RESULTCODEOPTION_InvalidOption + print(io, "Expected valid ResultCode (D, F, N, or V), got $(err.token)") + elseif err.code == RESULTCODEOPTION_NoOptions + print(io, "Must include one ResultCode") + else + @assert false "unreachable" + end #if +end #function + +@kwdef struct ResultCodeOptionVal{T} <: + OptParse.AbstractValueParser{T,ResultCodeOptionError} + metavar::String = "RESULT_CODES" +end #struct + +(rco::ResultCodeOptionVal{T})(input::AbstractString) where {T} = + let + val = uppercase(input) + occursin(r"[^DFNV]", val) && return OptParse.Result{T,ResultCodeOptionError}'.Err( + ResultCodeOptionError(RESULTCODEOPTION_InvalidOption, input), + ) + + occursin(r"[DFNV]", val) || return OptParse.Result{T,ResultCodeOptionError}'.Err( + ResultCodeOptionError(RESULTCODEOPTION_NoOptions, input), + ) + + return OptParse.Result{T,ResultCodeOptionError}'.Ok(parse(ResultCodeOption, input)) + end #let + +result_code_option(::Type{T}; kw...) where {T<:ResultCodeOption} = + ResultCodeOptionVal{T}(; kw...) +result_code_option(metavar::AbstractString, ::Type{T}; kw...) where {T<:ResultCodeOption} = + ResultCodeOptionVal{T}(; metavar = String(metavar), kw...) +result_code_option(; kw...) = ResultCodeOptionVal{ResultCodeOption}(; kw...) +result_code_option(metavar::AbstractString; kw...) = + ResultCodeOptionVal{ResultCodeOption}(; metavar = String(metavar), kw...) From 862f46b6631d41a17d21e2e31ef3a61bd9c4f3c4 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Fri, 13 Nov 2026 18:14:04 -0600 Subject: [PATCH 8/9] fix: Don't add unneeded padding in base30encode Tests were failing because f4d7f6 introduced padding to base30encode. The padding is needed to keep CualerIDs consistent, but it shouldn't be a universal feature of base30 values. Add a keyword argument to keep consistent behavior in CualerID, but make tests stay readable. --- src/Base30.jl | 17 +++++++++-------- src/Minting.jl | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Base30.jl b/src/Base30.jl index 98f4c00..05c0cab 100644 --- a/src/Base30.jl +++ b/src/Base30.jl @@ -27,11 +27,12 @@ const BASE30_ALPHABET = UInt8.([ ]) """ - base30encode(v::Integer) - base30encode(v::UUID) + base30encode(v::Integer; pad::Integer=1) + base30encode(v::UUID; pad::Integer=1) -Creates a base30 representation of `v`. If `v` is a `UUID`, then the `UInt128` -value of the `UUID` is passed directly into the method. +Creates a base30 representation of `v` padded out to `pad` digits. If `v` is a +`UUID`, then the `UInt128` value of the `UUID` is passed directly into the +method. # Examples @@ -45,12 +46,12 @@ julia> using UUIDs; base30encode(uuid1()) "7ZK00JECBDF2H7GNBXN59C6S9S" ``` """ -function base30encode(v::Integer) +function base30encode(v::Integer; pad::Integer = 1) return String([ - BASE30_ALPHABET[i] for i in reverse(digits(v; base = 30, pad = 29) .+ 1) + BASE30_ALPHABET[i] for i in reverse(digits(v; base = 30, pad = pad) .+ 1) ]) end #function -function base30encode(v::UUID) - return base30encode(v.value) +function base30encode(v::UUID; pad::Integer = 1) + return base30encode(v.value; pad = pad) end #function diff --git a/src/Minting.jl b/src/Minting.jl index e6613c2..52cb7c0 100644 --- a/src/Minting.jl +++ b/src/Minting.jl @@ -19,7 +19,7 @@ the human-readable representation of `u` function cualer_id(u::UUID; length::Integer = 29) length > 29 && throw(BoundsError("CualerIDs cannot be printed at lengths longer than 29")) - return base30encode(u)[(end-(length-1)):end] + return base30encode(u; pad = length)[(end-(length-1)):end] end #function """ From 5e33a2bccfab3d36c86677a727f9f99d2d9bc9d7 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Fri, 13 Nov 2026 18:14:47 -0600 Subject: [PATCH 9/9] feat: Replace ArgParse with OptParse argument parser --- Project.toml | 4 - src/CualerID.jl | 251 +++++++++++++++++----------------------- src/ResultCodeOption.jl | 2 +- 3 files changed, 108 insertions(+), 149 deletions(-) diff --git a/Project.toml b/Project.toml index 9b2f8f1..487039c 100644 --- a/Project.toml +++ b/Project.toml @@ -4,14 +4,10 @@ version = "0.0.1" authors = ["Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com> and contributors"] [deps] -ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63" -FilePathsBase = "48062228-2e41-5def-b9a4-89aafe57970f" OptParse = "1244ff17-1aa7-4121-9347-f4ead108e58f" UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [compat] -ArgParse = "1.2.0" -FilePathsBase = "0.9.24" OptParse = "0.4.3" UUIDs = "1.11.0" julia = "1.12" diff --git a/src/CualerID.jl b/src/CualerID.jl index 20581c1..db1f337 100644 --- a/src/CualerID.jl +++ b/src/CualerID.jl @@ -1,12 +1,25 @@ module CualerID -using ArgParse: ArgParse, ArgParseSettings, parse_args, parse_item, @add_arg_table! -using FilePathsBase: AbstractPath, Path, exists, isfile -using OptParse: OptParse +using OptParse: + @parser, + OptParse, + arg, + command, + default, + flag, + flt, + lift, + option, + or, + path, + runparse, + str, + u64 using UUIDs: UUID, uuid4 include("Base30.jl") include("ResultCodeOption.jl") +include("ResultCodeOptionValueParser.jl") include("Minting.jl") export ResultCode @@ -19,162 +32,112 @@ export has_not_fixable export has_valid export mint_ids! -function _create_arg_table() - s = ArgParseSettings(autofix_names = true) +@parser struct CreateIDs + @description "Create a set of new CualerIDs" - #! format: off - @add_arg_table! s begin - "create" - help = "Create CualerID sample ids or barcode labels" - action = :command - "fix" - help = "Compare a set of possibly invalid IDs against a correct set of IDs to identify errors in the IDs" - action = :command - "convert" - help = "Convert CualID sample ids to CualerID sample ids or vice-versa" - action = :command - end #add_arg_table + "The length of the printed sample ids" + length = option("-l", "--length", u64("LENGTH")) |> default(0x05) - @add_arg_table! s["create"] begin - "ids" - help = "Generate sample ids" - action = :command - "labels" - help = "Generate a pdf of barcodes (NOT YET IMPLEMENTED)" - action = :command - end #add_arg_table + "The fraction of ids which must be dissimilar" + fail_threshold = + option("-f", "--fail-threshold", flt("THRESHOLD"; min = 0.0, max = 1.0)) |> + default(0.99) - @add_arg_table! s["create"]["ids"] begin - "--length", "-l" - help = "The length of the printed sample ids" - arg_type = UInt64 - default = UInt64(5) - "--fail-threshold", "-f" - help = "The fraction of ids which must be dissimilar" - arg_type = Float64 - range_tester = x -> x >= 0 && x <= 1.0 - default = 0.99 - "number_of_ids" - help = "The number of sample ids to print" - arg_type = UInt64 - range_tester = x -> x >= 1 - required = true - end #add_arg_table + "The number of sample ids to print" + number_of_ids = arg(u64("NUMBER"; min = 0x01)) +end #struct - @add_arg_table! s["fix"] begin - "--correct-ids" - help = "Path to the list of correct ids" - arg_type = AbstractPath - range_tester = x -> exists(x) && isfile(x) - required = true - "--show", "-s" - help = """ - Which types of fixes should be printed to output. Can be a - combination of D for duplicate, F for fixed, N for not fixable, - and V for valid. - """ - arg_type = ResultCodeOption - default = ResultCodeOption("DFN") - "--all", "-a" - help = "Show all ids regardless of fixed status" - action = :store_true - "ids_to_be_corrected" - help = "File containing CualerIDs that need correction" - arg_type = AbstractPath - range_tester = x -> exists(x) && isfile(x) - required = true - end #add_arg_table +@parser struct CreateLabels + @description "Create printable labels from CualerIDs" - @add_arg_table! s["convert"] begin - "--length", "-l" - help = "The length of the printed sample ids" - arg_type = UInt64 - default = UInt64(5) - "--fail-threshold", "-f" - help = "NOT IMPLEMENTED: The rate at which similar ids will fail the process" - arg_type = Float64 - range_tester = x -> x >= 0 && x <= 1.0 - default = 0.99 - "--to-cual-id" - help = "Convert from CualerID to CualID" - action = :store_true - "ids_to_be_converted" - help = "TSV file containing CualIDs or CualerIDs to be converted" - arg_type = AbstractPath - range_tester = x -> exists(x) && isfile(x) - required = true - end #@add_arg_table! + """ + The input file containing sample ids. The input sample ids can be in either CualID or + CualerID format, but the output labels will always be in CualerID format. + """ + input = arg(path("SAMPLE_IDS")) - #! format: on + "Path to output file" + output_pdf = option("-o", "--output-pdf", path("OUTPUT_FILE")) - return s + "Do not print sample ids on the labels (i.e. barcodes only)" + suppress_ids = flag("--suppress-ids") + """ + Barcode type selector. This option is present to maintain cli compatibility with + cual-id, however it was never implemented in the original program, and as + such is not implemented, but instead silently ignored by cualer-id. + """ + barcode = option("--barcode", str("DUMMY")) |> default("DUMMY") +end #struct + +@parser struct Fix + @description "Fix typos in lists of CualerIDs" + + "Path to the list of correct ids" + correct_ids = option("--correct-ids", path("CORRECT_IDS")) + + """ + Which types of fixes should be printed to output. Can be a combination of D + for duplicate, F for fixed, N for not fixable, and V for valid. + """ + show = + option("-s", "--show", result_code_option("FIXES")) |> + default(ResultCodeOption("DFN")) + + # TODO: Implement the --all switch as an exclusive that returns + # a ResultCodeOption("DFNV") + + "File containing CualerIDs that need correction" + ids_to_be_corrected = arg(path("FILE")) +end #struct + +@parser struct Convert + @description "Convert existing CualIDs to CualerIDs (and vice-versa)" + + "The length of the printed sample ids" + length = option("-l", "--length", u64("LENGTH")) |> default(0x05) + + "The fraction of ids which must be dissimilar" + fail_threshold = + option("-f", "--fail-threshold", flt("THRESHOLD"; min = 0.0, max = 1.0)) |> + default(0.99) + + "Convert from CualerID to CualID" + to_cual_id = flag("--to-cual-id") + + "TSV file containing CualIDs or CualerIDs to be converted" + ids_to_be_converted = arg(path("SAMPLE_IDS")) +end #struct + +const CLI = or( + command( + "create", + or(command("ids", lift(CreateIDs)), command("labels", lift(CreateLabels))), + ), + command("fix", lift(Fix)), + command("convert", lift(Convert)), +) + +function (@main)(args) + opts = runparse(CLI, args; progname="cualer-id") + + # Exit early in case of a help command + isnothing(opts) && return 0 + + return _main(opts) end #function -const ARG_PARSE_TABLE = _create_arg_table() +function _main(opts::CreateIDs) + ids = mint_ids!(opts.number_of_ids, opts.length, opts.fail_threshold) -function _create(parsed_args::Dict{Symbol,Any}) - if parsed_args[:_COMMAND_] == :ids - _create_ids(parsed_args[:ids]) - elseif parsed_args[:_COMMAND_] == :labels - _create_labels(parsed_args[:labels]) - end #if + foreach(i -> println(i, '\t', cualer_id(i; length = opts.length)), ids) return 0 end #function -function _create_ids(parsed_args::Dict{Symbol,Any}) - ids = mint_ids!( - parsed_args[:number_of_ids], - parsed_args[:length], - parsed_args[:fail_threshold], - ) - - foreach(i -> println(i, '\t', cualer_id(i; length = parsed_args[:length])), ids) - - return 0 -end #function - -function _create_labels(parsed_args::Dict{Symbol,Any}) - println("COMMAND:\tcreate labels") - for (key, val) in parsed_args - println("\t$key:\t$val") - end #function - - return 0 -end #function - -function _fix(parsed_args::Dict{Symbol,Any}) - println("COMMAND:\tfix") - for (key, val) in parsed_args - println("\t$key:\t$val") - end #function - - return 0 -end #function - -function _convert(parsed_args::Dict{Symbol,Any}) - println("COMMAND:\tconvert") - for (key, val) in parsed_args - println("\t$key:\t$val") - end #function - - return 0 -end #function - - -function (@main)() - parsed_args = parse_args(ARG_PARSE_TABLE; as_symbols = true) - - if parsed_args[:_COMMAND_] == :create - _create(parsed_args[:create]) - elseif parsed_args[:_COMMAND_] == :fix - _fix(parsed_args[:fix]) - elseif parsed_args[:_COMMAND_] == :convert - _convert(parsed_args[:convert]) - end #if - - return 0 +function _main(opts) + @show opts + @assert false end #function end #module diff --git a/src/ResultCodeOption.jl b/src/ResultCodeOption.jl index b435609..77596ec 100644 --- a/src/ResultCodeOption.jl +++ b/src/ResultCodeOption.jl @@ -87,7 +87,7 @@ function Base.show(io::IO, r::ResultCodeOption) c -> r.val & UInt8(c) != 0 && print(io, string(Symbol(c))), instances(ResultCode), ) - print(io, ")") + return print(io, ")") end #function """