Giter VIP home page Giter VIP logo

Comments (3)

Derf000 avatar Derf000 commented on May 26, 2024 1

When you put it like that, the difference between A and B makes a lot of sense...
Thank you for your responsiveness and the new release.
👍

from clize.

Derf000 avatar Derf000 commented on May 26, 2024

Hi, thanks for update.

I dont know if it is related (and maybe it is 'normal') but i also found this "problem" :

Using description WITH alternate command list won't works

Using previously typed code :

    # CASE A -> OK
    run(echo, version, build_date, description="""
        test description
        """)

    # CASE B -> Not OK
    run(echo, alt=[version, build_date], description="""
        test description
        """)

Case B provide error :

Traceback (most recent call last):
  File "/home/user/MyPyProjs/Py390/CliTests/venv/lib/python3.9/site-packages/clize/runner.py", line 172, in get_cli
    cli = obj.cli
AttributeError: 'function' object has no attribute 'cli'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/MyPyProjs/Py390/CliTests/./clize_t01.py", line 53, in <module>
    run(echo, description="""
  File "/home/user/MyPyProjs/Py390/CliTests/venv/lib/python3.9/site-packages/sigtools/modifiers.py", line 161, in __call__
    return self.func(*args, **kwargs)
  File "/home/user/MyPyProjs/Py390/CliTests/venv/lib/python3.9/site-packages/clize/runner.py", line 381, in run
    cli = Clize.get_cli(fn, **kwargs)
  File "/home/user/MyPyProjs/Py390/CliTests/venv/lib/python3.9/site-packages/clize/runner.py", line 175, in get_cli
    cli = cls(obj, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'description'

from clize.

epsy avatar epsy commented on May 26, 2024

Hello!

Nothing apparently, that must've been a long-standing bug, even though the feature was documented. I've added tests to ensure this never breaks again.

https://github.com/epsy/clize/releases/tag/v5.0.1 fixes this, you can grab the updated version using pip (pip install --upgrade clize)


Regarding your second issue, this is not unexpected, though it could be clearer:

  • In case A, you have multiple commands to pick from, so there is a description= parameter available for run() so that you can provide a description.
  • In case B, you have one command with a few alternates. The main command's docstring can provide the description, so no description= argument is accepted.

I'll see tomorrow if the error message can be made more explicit about this. Thanks for reporting the issue.

from clize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.