Comments (3)
This is a great improvement and a big help! Thank you taking the time to improve the docs.
from cri.
option
’s argument:
parameter defaults to :forbidden
.
When an option has a forbidden argument, its value will end up being true
. This is intended for flags such as --verbose
:
flag :v, :verbose, 'be verbose'
# assuming the command is invoked with --verbose:
p options[:verbose]
# => true
When using multiple: true
, all option values end up in an array. For options with required arguments, this means the array ends up containing a list of strings, while for options with forbidden arguments, the array ends up containing a list of true
s:
flag :v, :verbose, 'be verbose', multiple: true
# assuming the command is invoked with --verbose --verbose --verbose:
p options[:verbose]
# => [true, true, true]
The documentation is admittedly unclear on :forbidden
being the default, and on the array of true
s. Will update.
from cri.
Hi,
I’ve greatly expanded the section on how to define command-line options. It now has an explicit section on argument:
, and also comes with a handful of examples. This should make it more understandable.
Let me know what you think!
from cri.
Related Issues (20)
- Options from one command appear in other commands
- Consider making it clearer that --verbose is an option for the help subcommand itself HOT 4
- 2.15.8 breaks nanoc HOT 6
- Handler for command line parameters and option errors
- Platform colour detection uses outdated technique on Windows HOT 3
- Warning with ruby 2.7 HOT 3
- [Feature Request]: Change symbols with dashes/hyphens to underscores
- Add negatable long-form options HOT 1
- Enhance #param to allow :optional and a description
- make a new release? HOT 2
- Feature: Arbitrary arguments HOT 3
- uninitialized constant Cri::Error HOT 2
- Options propagation on subcommand tree HOT 4
- iterating over arguments fails since 2.12 HOT 2
- colored breaks awesome_print HOT 3
- Release 2.15.4 breaks semver HOT 10
- Commands without `summary` does not even show command name HOT 2
- Forbidden optional parameters set to ` nil` when not present in command line HOT 15
- Version 2.15.7 causes runtime error HOT 1
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 cri.