Comments (3)
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.
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.
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)
- autom4te Error: invalid command code m, end of file in string: syntax error in expression HOT 1
- ARG_LEFTOVERS functionality dependent on bash version HOT 1
- Invalid short and long options are treated as positional arguments HOT 2
- evaluate_strictness make the script fail if executed with errexit HOT 1
- feature request: add possibility to add code before the argbash definitions HOT 2
- make compatible with errexit and nounset HOT 1
- Fluent API like commands HOT 2
- SSL Certificate does't match argbash.io HOT 2
- Project description: add https://argbash.dev
- Clarify license implication of using argbash
- Show example usage in the readme (hello world example)
- PKGBUILD.in missing dependency rst2man for generating manpages HOT 3
- Calculate default value at run time?
- parse_commandline: _key should be local?
- Perform argbash arg parsing for bash functions HOT 1
- Feature Request: GIT style commands with arguments HOT 1
- Hardcoded bash path? HOT 1
- Feature Request: Argbash clean command/output type
- Online generator still uses release 2.9.0 with generated code pointing to argbash.io
- argbash.dev is down HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from argbash.