CommanderRuby 命令行框架
Commander 是 Ruby 命令行执行补全解决方案。
安装:
$ gem install commander
代码示例:
require 'rubygems' require 'commander/import' # :name is optional, otherwise uses the basename of this executable program :name, 'Foo Bar' program :version, '1.0.0' program :description, 'Stupid command that prints foo or bar.' command :foo do |c| c.syntax = 'foobar foo' c.description = 'Displays foo' c.action do |args, options| say 'foo' end end command :bar do |c| c.syntax = 'foobar bar [options]' c.description = 'Display bar with optional prefix and suffix' c.option '--prefix STRING', String, 'Adds a prefix to bar' c.option '--suffix STRING', String, 'Adds a suffix to bar' c.action do |args, options| options.default :prefix => '(', :suffix => ')' say "#{options.prefix}bar#{options.suffix}" end end
示例输出:
$ foobar bar # => (bar) $ foobar bar --suffix '}' --prefix '{' # => {bar}
评论
Commander.jsNode.js 命令行框架
Commander.js是Node.js命令行接口的补全解决方案,灵感来源于Ruby的commander。安装:$ npm install commander代码示例:#!/usr/bin/env n
Commander.jsNode.js 命令行框架
0
Commander.jsNode.js 命令行框架
Commander.js 是 Node.js 命令行接口的补全解决方案,灵感来源于 Ruby 的 c
Commander.jsNode.js 命令行框架
0
VorpalNode 命令行应用框架
Vorpal是一个Node用来构建CLI命令行应用的框架。提供简单但强大的API。功能包括:简单强大的命令创建支持可选参数、必选参数和可变参数管道命令可持久化保持命令行历史记录内建帮助内建对Tab自动
VorpalNode 命令行应用框架
0