cleo icon indicating copy to clipboard operation
cleo copied to clipboard

Stop escaping the default values of arguments/options when displaying help

Open pmav99 opened this issue 7 years ago • 0 comments

In the help message, the default values seem to be escaped which is probably misleading for the potential users. E.g., in the following example, the separator option defaults to \. Nevertheless, what is being displayed in the help message is:

OPTIONS
  -s (--separator)       The separator (default: "\\")

Notice the "\\"

Minimal Working example

from cleo import Application
from cleo import Command

class MyCommand(Command):
    """
    Command description

    cmd
        {--s|separator=\ : The separator}
    """
    def handle(self):
        separator = self.option("separator")
        print(separator)
        print(repr(separator))
        print(len(separator))
        print(type(separator))
        if separator == "\\":
            print("Yay!")

def main():
    application = Application()
    application.add(MyCommand())
    application.run()

if __name__ == "__main__":
    main()

pmav99 avatar Jan 09 '19 19:01 pmav99