Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Help text wraps; terminal width not detected correctly #263

Open
jakobnissen opened this issue Oct 25, 2023 · 2 comments
Open

[BUG] Help text wraps; terminal width not detected correctly #263

jakobnissen opened this issue Oct 25, 2023 · 2 comments
Labels
bug Something isn't working display printing & display related issues

Comments

@jakobnissen
Copy link
Contributor

A script with the following content:

using Comonicon

"""
# Intro
Benchmark a set of bins agains a reference

# Args
- `ref`: Path to reference JSON file (see the `makeref subcommand`)
- `bins`: Paths to TSV files of bins.

# Options
- `-r, --rank`: Taxonomic rank to benchmark
- `-s, --sep`: Binsplit separator; delimiter to split bins
- `--minsize`: Remove bins with shorter breadth
- `--minseqs`: Remove bins fewer sequences
- `--keep-flags`: Only keep genomes with all these flags set.
  Takes a comma-separated list of flags, e.g. "virus,plasmid"
- `--remove-flags`: Remove genomes with any of these flags set. See above.
- `--recalls`: Comma-separated list of recall thresholds to use
- `--precisions`: Comma-separated list of precision thresholds to use

# Flags
- `--assembly`: Count number of recovered assemblies, not genomes
- `--intersect`: Allow the same sequence to be in multiple bins
"""
Comonicon.@main function bench(
    ref::String,
    bins...; # TODO: Explicit type here, but Comonicon issue #261 prevents this
    rank::Int=0,
    sep::Union{String, Nothing}=nothing,
    minsize::Int=1,
    minseqs::Int=1,
    keep_flags::String,
    remove_flags::String,
    recalls::Vector{Float64}=[0.6, 0.7, 0.8, 0.9, 0.95, 0.99],
    precisions::Vector{Float64}=[0.6, 0.7, 0.8, 0.9, 0.95, 0.99],
    assembly::Bool=false,
    intersect::Bool=false,
)
    nothing
end

And invoked like this: julia --startup=no --project=. foo.jl -h.
You can see in the screenshot below that the description for e.g. keep-flags wraps around, presumably because the display size is incorrectly computed.

Version of the package:
This is on Comonicon 1.0.6.

Expected behavior
I would expect the text to not wrap all the way to the left of the screen, but wrap on the right side, where the descriptions are.

Screenshots
Screenshot from 2023-10-25 15-57-15

@jakobnissen jakobnissen added the bug Something isn't working label Oct 25, 2023
@Roger-luo
Copy link
Collaborator

hmm, this is not expected, I guess something went wrong in detecting the displaysize, we just use this to detect the size, if your width is smaller than 80 however, we currently will use 80 instead. It might be better to see if we can provide a more compact printing instead of doing everything two column.

@Roger-luo Roger-luo added the display printing & display related issues label Oct 25, 2023
@jakobnissen
Copy link
Contributor Author

But I have:

julia> displaysize(stdout)
(55, 106)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working display printing & display related issues
Projects
None yet
Development

No branches or pull requests

2 participants