Skip to content

AddOption(shortOption ...) does not fully add the short option #3798

Closed
@DeeeeLAN

Description

@DeeeeLAN

Describe the bug
If you try and add a short option (-x), it doesn't process far enough to actually be usable from the command line. It does get processed enough to show up in the help message, however, which can lead to visible confusion by the end user.

Required information

  • Link to SCons Users thread discussing your issue.
    • discussed in discord
  • Version of SCons
    • 4.0.1
  • Version of Python
    • 3.8.1
  • Which python distribution if applicable (python.org, cygwin, anaconda, macports, brew,etc)
    • python.org
  • How you installed SCons
    • built by source I believe
  • What Platform are you on? (Linux/Windows and which version)
    • Linux, CentOS 7
  • How to reproduce your issue? Please include a small self contained reproducer. Likely a SConstruct should do for most issues.
AddOption('-x', '--longX',
          action='store_true', 
          dest='xvar', 
          default=False,
          help="Test short option"
print(GetOption('xvar'))
  • How you invoke scons (The command line you're using "scons --flags some_arguments")
scons -h
scons -x

Note, my preference is to fix this rather than disallow it in the docs because if the variable I want to add is a file, the long option prevents me from using tab completion. If I try to do --longX=path/to/file.x I have to type it manually, but if I can do -x path/to/file.x, I can tab complete to enter the file path. That is how I initially stumbled upon this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    args_and_optionsoptions processing, arguments, get/setoption and their relationshiop

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions