Giter VIP home page Giter VIP logo

Comments (3)

dkvc avatar dkvc commented on June 16, 2024

I think this can be done by making the argument spec as variadic argument (accepting infinte arguments and setting it as required such that at least one arg is required.). Then iterating through all values, removing them one by one.

[...]
@click.argument('spec', nargs=-1, required=True)
[...]
    for sp in spec:
         helpers.entity_remove(api.TimeEntry, sp, ('id', 'description'), obj=ctx.obj)
[...]

While this implementation prevents breaking previous versions, it has an issue. If one of the amidst time entry doesn't exist, the program halts. Is there any way to prevent this issue?

from toggl-cli.

StanczakDominik avatar StanczakDominik commented on June 16, 2024

How exactly does it halt? Does it just throw an exception? Can't you wrap that in a try/except block?

from toggl-cli.

dkvc avatar dkvc commented on June 16, 2024

In entity remove, this line halts the program if entry is not found.

[...]
def entity_remove():
[...]
    if not entities:
        click.echo('{} not found!'.format(cls.get_name(verbose=True)), color=theme.error_color)
        exit(44)
[...]

While exit(44) can be removed, the terminal returns exit status 0 even if not found.

from toggl-cli.

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.