CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Tue, 02 Sep 2025 14:51:51 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20100831204326
location: https://web.archive.org/web/20100831204326/https://github.com/opscode/mixlib-cli
server-timing: captures_list;dur=0.785306, exclusion.robots;dur=0.030395, exclusion.robots.policy;dur=0.011578, esindex;dur=0.016443, cdx.remote;dur=355.238639, LoadShardBlock;dur=1499.349784, PetaboxLoader3.datanode;dur=1088.929854, PetaboxLoader3.resolve;dur=290.380225
x-app-server: wwwb-app210
x-ts: 302
x-tr: 1952
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app210; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Tue, 02 Sep 2025 14:51:54 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.7.67
x-archive-orig-date: Tue, 31 Aug 2010 20:43:26 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-etag: "816f46fdfebee61af9aaab8279fd56b2"
x-archive-orig-x-runtime: 66ms
x-archive-orig-content-length: 31205
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Tue, 31 Aug 2010 20:43:26 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Tue, 31 Aug 2010 20:43:26 GMT", ; rel="memento"; datetime="Tue, 31 Aug 2010 20:43:26 GMT", ; rel="next memento"; datetime="Fri, 04 May 2012 14:33:16 GMT", ; rel="last memento"; datetime="Sun, 22 Jun 2025 19:18:33 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_17_20100831162718_crawl101-c/52_17_20100831204223_crawl101.arc.gz
server-timing: captures_list;dur=0.674821, exclusion.robots;dur=0.025064, exclusion.robots.policy;dur=0.010800, esindex;dur=0.015587, cdx.remote;dur=55.664212, LoadShardBlock;dur=1160.385672, PetaboxLoader3.datanode;dur=793.688484, PetaboxLoader3.resolve;dur=625.157759, load_resource;dur=520.789612
x-app-server: wwwb-app210
x-ts: 200
x-tr: 1859
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
opscode's mixlib-cli at master - GitHub
opscode / mixlib-cli
- Source
- Commits
- Network (14)
- Issues (2)
- Downloads (9)
- Wiki (1)
- Graphs
-
Branch:
master
click here to add a description
click here to add a homepage
Sending Request…
A mixin for creating command line applications - gives an easy DSL for argument specification and processing — Read more
name | age | message | |
---|---|---|---|
![]() |
.gitignore | Tue Dec 15 15:46:41 -0800 2009 | added mixlib-cli.gemspec to .gitignore [Christopher Brown] |
![]() |
LICENSE | Thu Mar 12 17:40:24 -0700 2009 | Initial commit [adamhjk] |
![]() |
NOTICE | Thu Mar 12 17:40:24 -0700 2009 | Initial commit [adamhjk] |
![]() |
README.rdoc | Wed Mar 31 15:05:48 -0700 2010 | Bumping to version 1.2.0 [adamhjk] |
![]() |
Rakefile | Wed Mar 31 15:05:48 -0700 2010 | Bumping to version 1.2.0 [adamhjk] |
![]() |
VERSION.yml | Wed Mar 31 15:05:48 -0700 2010 | Bumping to version 1.2.0 [adamhjk] |
![]() |
features/ | Mon May 11 21:05:35 -0700 2009 | Convert mixlib-cli to jeweler. [fujin] |
![]() |
lib/ | Fri Mar 26 13:51:44 -0700 2010 | moving argv.dup to top of parse_options to pres... [Stephen Delano] |
![]() |
spec/ | Fri Mar 26 13:52:27 -0700 2010 | adding test for parse_options return behavior [Stephen Delano] |
README.rdoc
Mixlib::CLI
Mixlib::CLI provides a class-based command line option parsing object, like the one used in Chef, Ohai and Relish. To use in your project:
require 'rubygems' require 'mixlib/cli' class MyCLI include Mixlib::CLI option :config_file, :short => "-c CONFIG", :long => "--config CONFIG", :default => 'config.rb', :description => "The configuration file to use" option :log_level, :short => "-l LEVEL", :long => "--log_level LEVEL", :description => "Set the log level (debug, info, warn, error, fatal)", :required => true, :proc => Proc.new { |l| l.to_sym } option :help, :short => "-h", :long => "--help", :description => "Show this message", :on => :tail, :boolean => true, :show_options => true, :exit => 0 end # ARGV = [ '-c', 'foo.rb', '-l', 'debug' ] cli = MyCLI.new cli.parse_options cli.config[:config_file] # 'foo.rb' cli.config[:log_level] # :debug
If you are using this in conjunction with Mixlib::Config, you can do something like this (building on the above definition):
class MyConfig extend(Mixlib::Config) log_level :info config_file "default.rb" end class MyCLI def run(argv=ARGV) parse_options(argv) MyConfig.merge!(config) end end c = MyCLI.new # ARGV = [ '-l', 'debug' ] c.run MyConfig[:log_level] # :debug
Available arguments to ‘option’:
:short: | The short option, just like from optparse. Example: "-l LEVEL" |
:long: | The long option, just like from optparse. Example: "—level LEVEL" |
:description: | The description for this item, just like from optparse. |
:default: | A default value for this option |
:required: | Prints a message informing the user of the missing requirement, and exits. Default is false. |
:on: | Set to :tail to appear at the end, or :head to appear at the top. |
:boolean: | If this option takes no arguments, set this to true. |
:show_options: | If you want the option list printed when this option is called, set this to true. |
:exit: | Exit your program with the exit code when this option is specified. Example: 0 |
:proc: | If set, the configuration value will be set to the return value of this proc. |
New in 1.2.0
We no longer destructively manipulate ARGV.
Have fun!
- © 2010 GitHub Inc. All rights reserved.
- Terms of Service
- Privacy
- Security