Giter VIP home page Giter VIP logo

Comments (3)

matejak avatar matejak commented on June 5, 2024

To choose on instead of true was a deliberate decision - in shells, true is also a command with return value of 0. Although a string true would be OK, I wanted to avoid the confusion, and wanted to go for something that is as unambiguous as possible.
Please, consider on and off as part of the API. You can translate those values easily using dictionaries or associative arrays in the script or in the called program - fortunatelly, you have to do it only once.

from argbash.

filmil avatar filmil commented on June 5, 2024

Noted and thank you for explaining. That said, I am not sure that I follow the line of reasoning about boolean flag values:

  • I would think that if someone is misusing something what is supposed to be a boolean flag value, they have a bigger issue than mixing up the program true and a string "true". Ideally this is what unit tests would be for. Though hardly anyone writes them for bash.
  • Sometimes the program to be ran was not written by me, so I don't have an option to rig the flags inside a program to accept an on value as "true". Note that for example, go supports a few pairs of values (true and false; 1 and 0; T and F) which would all work. I guess they could support "on" and "off" as well, but that's not likely to happen on a dime.
  • The point of code generation is to minimize the amount of adaptation needed in addition to generated code. So if I have to write an adapter to parse flags on top of what the parsing library already does, that feels like defeat.

But I do accept your explanation -- argbash doesn't need to work for everyone perfectly, and in the end it is possible to make a translation function, or even fork your own argbash.

from argbash.

matejak avatar matejak commented on June 5, 2024

You are right that confusing the string true for something that could be interpreted as not true is unlikely. However, this doc snippet devotes quite a lot of energy into explaining what true is and what isn't. I have realized that even small children in non-English-speaking countries know the meaning of on and off, so I went for that path, as I believe that it is more deeply rooted in our subconsciousness.

However thank you for your feedback, nothing is set in stone, and who knows how argbash 3.0 API will look like :-)

from argbash.

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.