nodejs里的commander库可以方便的帮你写一个命令行程序.
program = require 'commander'
program
.version("0.0.1")
.option('-v --version', 'version info')
console.log '0.0.1' if program.version?
上面的脚本是用CoffeeScript写的,
运行`coffee test.coffee -v`后就会输出 -- ‘0.0.1’
nodejs里的commander库可以方便的帮你写一个命令行程序.
program = require 'commander'
program
.version("0.0.1")
.option('-v --version', 'version info')
console.log '0.0.1' if program.version?
上面的脚本是用CoffeeScript写的,
运行`coffee test.coffee -v`后就会输出 -- ‘0.0.1’
转载于:https://www.cnblogs.com/buhaiqing/archive/2013/01/19/2867841.html