Code Monkey home page Code Monkey logo

Comments (6)

kbrock avatar kbrock commented on August 29, 2024

At first I totally agreed, now I'm mixed on this one.

If you specify --help on the command line, are you expecting a non 0 return status?

In your example, is help coming from a misuse, or an error?

from optimist.

jaredbeck avatar jaredbeck commented on August 29, 2024

If you specify --help on the command line, are you expecting a non 0 return status?

Good point. If I'm requesting --help, I'd expect 0.

In your example, is help coming from a misuse, or an error?

Misuse, i.e. any time the usage is printed except for when --help is requested.

from optimist.

kbrock avatar kbrock commented on August 29, 2024

@jaredbeck do you have a test case (not formally)

4 liner parse and opt blurb with a description of what you pass in on the command line and when you expect to get errors?

I can convert into an official test, just want to make sure I am coding up your case.

--Keenan

from optimist.

jaredbeck avatar jaredbeck commented on August 29, 2024

Sure, let me see what I can come up with. What if we consider cp? It takes a variety of options and (usually) two arguments, a source path and a target path. When only one argument is given, it prints usage and exits with a specific non-zero code.

It's my understanding that trollop is responsible only for options. After parsing options, only the arguments are left in ARGV, right? So, if we were implementing cp, we'd check the length of the remaining arguments. If there were only one argument, we'd print usage and exit with that specific code.

Is that a good example? Do you want me to take the next step and write an opt blurb for it?

from optimist.

kbrock avatar kbrock commented on August 29, 2024

@jaredbeck No code needed. I had misunderstood you. pr 58 helped a lot.
I have what I consider a good fix, but am in the middle of a refactor in the test area.

If I don't merge in a fix for your issue by next friday, please ping me to keep me honest.

from optimist.

kbrock avatar kbrock commented on August 29, 2024

After I get #61 in, I'll tack this on

from optimist.

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.