just icon indicating copy to clipboard operation
just copied to clipboard

Improper alignment of the command list output with arguments."

Open badele opened this issue 1 year ago • 5 comments

Just version: 1.24

If i execute this command just --list i have this output

We can see that the just program align correctly the recipes witouth argument, that is not true for the recipes with arguments

Available recipes:
    doc-update FAKEFILENAME # Update documentation
    help                    # Help it showed if just is called without arguments
    home-build              # Home build for local user
    home-deploy             # Home deploy local user
    iso-build               # Build NixOS ISO image
    iso-clean               # Clean ISO vm test
    iso-start               # Start test NixOS ISO image
    iso-stop                # Stop ISO vm test
    iso-test                # Test ISO image (ESC for select boot device)
    iso-test-install        # Test NixOS deployment with custom ISO image (ESC for select boot device)
    iso-test-remote-deploy  # Test NixOS update deployment with custom ISO image (ESC for select boot device)
    lint                    # Lint the project
    nixos-build hostname="" options="" # Nixos build local host
    nixos-deploy hostname="" options="" # Deploy NixOS on local host
    nixos-init-host host    # Init nixos host if not exists
    nixos-install hostname targetip port="22" # Install new <hostname> to <target>:<port> system wide
    nixos-remote-deploy hostname targetip # Deploy NixOS on remote host
    packages                # Show installed packages
    passwd-generate         # Generate random password
    precommit-check         # precommit check
    precommit-install       # Setup pre-commit
    precommit-update        # Update pre-commit
    repl                    # Repl the project
    secret-update FILE      # Update secrets SOPS

From bash, we can align the just output command with just --list | column -s '#' -t -o '#'

I think it would be nice to add the fix directly to the rust code of course if it's not too complicated to modify the just command output alignment code.

Available recipes:                            #
    doc-update FAKEFILENAME                   # Update documentation
    help                                      # Help it showed if just is called without arguments
    home-build                                # Home build for local user
    home-deploy                               # Home deploy local user
    iso-build                                 # Build NixOS ISO image
    iso-clean                                 # Clean ISO vm test
    iso-start                                 # Start test NixOS ISO image
    iso-stop                                  # Stop ISO vm test
    iso-test                                  # Test ISO image (ESC for select boot device)
    iso-test-install                          # Test NixOS deployment with custom ISO image (ESC for select boot device)
    iso-test-remote-deploy                    # Test NixOS update deployment with custom ISO image (ESC for select boot device)
    lint                                      # Lint the project
    nixos-build hostname="" options=""        # Nixos build local host
    nixos-deploy hostname="" options=""       # Deploy NixOS on local host
    nixos-init-host host                      # Init nixos host if not exists
    nixos-install hostname targetip port="22" # Install new <hostname> to <target>:<port> system wide
    nixos-remote-deploy hostname targetip     # Deploy NixOS on remote host
    packages                                  # Show installed packages
    passwd-generate                           # Generate random password
    precommit-check                           # precommit check
    precommit-install                         # Setup pre-commit
    precommit-update                          # Update pre-commit
    repl                                      # Repl the project
    secret-update FILE                        # Update secrets SOPS

badele avatar Apr 07 '24 17:04 badele

I'm also interested in seeing this addressed.

johnalotoski avatar Apr 16 '24 16:04 johnalotoski

Currently, just uses a maximum line width of 30. If a recipe plus arguments is longer than 30 characters, just won't take it into consideration when aligning doc comments. This idea was to avoid a very long recipe signature causing all other lines having a huge alignment. I increased it from 30 to 50, since it was just kind of an arbitrary number, see #2039.

This could be removed entirely, or be made configurable. I'll leave this open to collect feedback. Please feel free to comment on your preference, either way.

casey avatar May 15 '24 02:05 casey

This could be removed entirely, or be made configurable. I'll leave this open to collect feedback. Please feel free to comment on your preference, either way.

Since the code already exists, and that it is now set to 50. I think that in the future, it would be either to add the possibility of adding a command option or to read the value from the environment variable.

Note: Thank you for updating the width value

badele avatar May 19 '24 21:05 badele

My vote would be to make this setting configurable. Thank you!

johnalotoski avatar May 20 '24 14:05 johnalotoski

I'd be totally fine with making it configurable. It just takes adding a new argument to config.rs, where it can also be made configurable with an environment variable at the same time.

casey avatar May 20 '24 19:05 casey