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

Indentation issues result when more complicated option aliases are used #758

Open
sereneiconoclast opened this issue Nov 1, 2021 · 1 comment

Comments

@sereneiconoclast
Copy link

Demo (using Ruby 2.7.4):

require 'thor'

class MyThor < Thor
  default_command :go
  desc '', 'Do some stuff'
  long_desc <<~LONG_DESC
    Do some stuff.
  LONG_DESC

  option "verbose", desc: "verbose logging", aliases: %w(-v), type: :boolean
  option "debug", desc: "debug mode", type: :boolean

  # If this next option is commented out, the 'help' output lines them up nicely
  #
  # Options:
  #   -v, [--verbose], [--no-verbose]  # verbose logging
  #       [--debug], [--no-debug]      # debug mode
  #
  # If it is present, the indentation is uneven:
  #
  # Options:
  #   -v, [--verbose], [--no-verbose]                # verbose logging
  #           [--debug], [--no-debug]                # debug mode
  #   -p, --post-to-gh, [--post-to-github=USERNAME]  # post to a GitHub repository
  #
  # Preferred output:
  #
  # Options:
  #   -v, [--verbose], [--no-verbose]                           # verbose logging
  #       [--debug], [--no-debug]                               # debug mode
  #   -p, [--post-to-gh=USERNAME], [--post-to-github=USERNAME]  # post to a GitHub repository

  option "post-to-github", desc: "post to a GitHub repository", aliases: %w(-p --post-to-gh), banner: 'USERNAME'

  def go
    puts("Options: #{options.inspect}")
  end
end

MyThor.start(ARGV)

The options work as expected. It's only the "help go" output that has an issue.

Thanks!

@dorner
Copy link

dorner commented Nov 2, 2021

Would be great to see a pull request fixing this! 😄

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

No branches or pull requests

2 participants