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

Add an option in printing to turn on/off double spacing in help message #275

Open
MilesCranmer opened this issue Apr 25, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@MilesCranmer
Copy link

My package AirspeedVelocity.jl has its help message with double lined spaces:

Screenshot 2024-04-25 at 12 54 18

It's been this way for a while but I'm adding more arguments now and its filling up beyond the terminal screen.

Is this expected? Is there any way to have it give single lined spaces instead?

Here is the command: https://github.com/MilesCranmer/AirspeedVelocity.jl/blob/master/src/BenchPkg.jl#L40. I see the double spacing this in both zsh and nushell.

@MilesCranmer MilesCranmer added the bug Something isn't working label Apr 25, 2024
@Roger-luo
Copy link
Collaborator

yes, there are only two columns at the moment.

@Roger-luo Roger-luo added enhancement New feature or request and removed bug Something isn't working labels Apr 25, 2024
@MilesCranmer
Copy link
Author

Sorry what I meant is the vertical spacing – seems to have a lot of space between each argument (especially at the top):

Compared to a regular man page:

Screenshot 2024-04-25 at 17 31 12

and, e.g., julia itself:

Screenshot 2024-04-25 at 17 31 32

@Roger-luo
Copy link
Collaborator

you mean no space between commands? Or there is double space before Usage?

@MilesCranmer
Copy link
Author

Right now it gets printed like this:

  benchpkg



Usage

  benchpkg <args> [options] [flags]

Args

  [package_name]                                            Name of the package. If not given, will be inferred.



Options

  -r, --rev <arg>                                           Revisions to test (delimit by comma). Use dirty to
                                                            benchmark the current state of the package at path
                                                            (and not a git commit). If not given, will be inferred based
                                                            on context.

  -o, --output-dir <arg>                                    Where to save the JSON results.

  -s, --script <arg>                                        The benchmark script. Default:
                                                            benchmark/benchmarks.jl downloaded from
                                                            stable.

  -e, --exeflags <arg>                                      CLI flags for Julia (default: none).

  -a, --add <arg>                                           Extra packages needed (delimit by comma).

  --url <arg>                                               URL of the package.

  --path <arg>                                              Path of the package.

  --bench-on <arg>                                          If the script is not set, this specifies the revision at
                                                            which to download benchmark/benchmarks.jl from the
                                                            package.

  -f, --filter <arg>                                        Filter the benchmarks to run (delimit by comma).

  --nsamples-load-time <arg>                                Number of samples to take when measuring load time of the
                                                            package (default: 5). (This means starting a Julia process
                                                            for each sample.)



Flags

  --tune                                                    Whether to run benchmarks with tuning (default: false).

  -h, --help                                                Print this help message.
  --version                                                 Print version.

I would like it to get printed as this:

  benchpkg

Usage
  benchpkg <args> [options] [flags]

Args
  [package_name]                                            Name of the package. If not given, will be inferred.

Options
  -r, --rev <arg>                                           Revisions to test (delimit by comma). Use dirty to
                                                            benchmark the current state of the package at path
                                                            (and not a git commit). If not given, will be inferred based
                                                            on context.
  -o, --output-dir <arg>                                    Where to save the JSON results.
  -s, --script <arg>                                        The benchmark script. Default:
                                                            benchmark/benchmarks.jl downloaded from
                                                            stable.
  -e, --exeflags <arg>                                      CLI flags for Julia (default: none).
  -a, --add <arg>                                           Extra packages needed (delimit by comma).
  --url <arg>                                               URL of the package.
  --path <arg>                                              Path of the package.
  --bench-on <arg>                                          If the script is not set, this specifies the revision at
                                                            which to download benchmark/benchmarks.jl from the
                                                            package.
  -f, --filter <arg>                                        Filter the benchmarks to run (delimit by comma).
  --nsamples-load-time <arg>                                Number of samples to take when measuring load time of the
                                                            package (default: 5). (This means starting a Julia process
                                                            for each sample.)
Flags
  --tune                                                    Whether to run benchmarks with tuning (default: false).
  -h, --help                                                Print this help message.
  --version                                                 Print version.

To save on vertical space.

@Roger-luo
Copy link
Collaborator

The proposed format here looks too dense to me when the description is long, it's hard to tell which text belong to which option, which was why I put space in between, so it's not a bug it's a feature... I'm OK with having an option to turn this on/off. But I currently don't have the capacity to work on it. I'm preparing my defense. It shouldn't be too hard to add it here: https://github.com/comonicon/Comonicon.jl/blob/main/src/ast/printing.jl#L51

@Roger-luo Roger-luo changed the title Fixing double spacing in help message Add an option in printing to turn on/off double spacing in help message Apr 28, 2024
@MilesCranmer
Copy link
Author

it's hard to tell which text belong to which option

I agree with that – I think it would also be nice to reduce the margin in the middle. See the Julia help menu:

image

It's nice because (a) it fits in my terminal window, and (b) you can still associate text and options.

@Roger-luo
Copy link
Collaborator

yeah, it's prob because the two columns are too far. I agree with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants