traceur-rb 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (410) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +2 -2
  3. data/lib/js/compile.js +7 -15
  4. data/lib/traceur.rb +2 -1
  5. data/lib/traceur/compilation_error.rb +27 -0
  6. data/lib/traceur/compiler.rb +4 -1
  7. data/lib/traceur/configuration.rb +1 -1
  8. data/lib/traceur/node/runner.rb +1 -1
  9. data/lib/traceur/version.rb +1 -1
  10. data/spec/examples/syntax_error.js +3 -0
  11. data/spec/integration/examples_spec.rb +6 -0
  12. data/vendor/node_modules/traceur/LICENSE +202 -0
  13. data/vendor/node_modules/traceur/README.md +5 -5
  14. data/vendor/node_modules/traceur/bin/traceur-runtime.js +1392 -623
  15. data/vendor/node_modules/traceur/bin/traceur.js +24749 -17990
  16. data/vendor/node_modules/traceur/node_modules/.bin/semver +2 -2
  17. data/vendor/node_modules/traceur/node_modules/commander/History.md +222 -0
  18. data/vendor/node_modules/traceur/node_modules/commander/Readme.md +127 -35
  19. data/vendor/node_modules/traceur/node_modules/commander/index.js +261 -93
  20. data/vendor/node_modules/traceur/node_modules/commander/package.json +41 -9
  21. data/vendor/node_modules/traceur/node_modules/glob/LICENSE +15 -0
  22. data/vendor/node_modules/traceur/node_modules/glob/README.md +357 -0
  23. data/vendor/node_modules/traceur/node_modules/glob/common.js +177 -0
  24. data/vendor/node_modules/traceur/node_modules/glob/glob.js +649 -0
  25. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
  26. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/LICENSE +15 -0
  27. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/README.md +37 -0
  28. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/inflight.js +44 -0
  29. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
  30. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
  31. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +34 -0
  32. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
  33. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
  34. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/package.json +61 -0
  35. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/test.js +97 -0
  36. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/LICENSE +16 -0
  37. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/README.md +42 -0
  38. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits.js +1 -0
  39. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
  40. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/package.json +33 -0
  41. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/test.js +25 -0
  42. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.npmignore +1 -0
  43. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.travis.yml +4 -0
  44. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
  45. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/README.md +216 -0
  46. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/benchmark.js +15 -0
  47. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/browser.js +1181 -0
  48. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/minimatch.js +845 -0
  49. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +2 -0
  50. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml +3 -0
  51. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +121 -0
  52. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
  53. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
  54. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
  55. data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/collections → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/.travis.yml +0 -0
  56. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
  57. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +80 -0
  58. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
  59. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +38 -0
  60. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +73 -0
  61. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +56 -0
  62. data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/url2 → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/.travis.yml +1 -1
  63. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
  64. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
  65. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
  66. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
  67. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +83 -0
  68. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
  69. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +75 -0
  70. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js +32 -0
  71. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt +1075 -0
  72. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt +182 -0
  73. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js +9 -0
  74. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js +10 -0
  75. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh +24 -0
  76. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js +15 -0
  77. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js +16 -0
  78. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js +10 -0
  79. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js +13 -0
  80. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js +7 -0
  81. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js +50 -0
  82. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/package.json +60 -0
  83. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
  84. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/brace-expand.js +45 -0
  85. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
  86. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
  87. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/LICENSE +27 -0
  88. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/README.md +51 -0
  89. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
  90. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
  91. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +34 -0
  92. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
  93. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
  94. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/once.js +21 -0
  95. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/package.json +42 -0
  96. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/test/once.js +23 -0
  97. data/vendor/node_modules/traceur/node_modules/glob/package.json +72 -0
  98. data/vendor/node_modules/traceur/node_modules/glob/sync.js +409 -0
  99. data/vendor/node_modules/traceur/node_modules/rsvp/.release.json +17 -0
  100. data/vendor/node_modules/traceur/node_modules/rsvp/CHANGELOG.md +165 -0
  101. data/vendor/node_modules/traceur/node_modules/rsvp/LICENSE +19 -0
  102. data/vendor/node_modules/traceur/node_modules/rsvp/README.md +364 -0
  103. data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.js +1671 -0
  104. data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.min.js +9 -0
  105. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.js +66 -0
  106. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.umd.js +50 -0
  107. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/-internal.js +265 -0
  108. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all-settled.js +71 -0
  109. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all.js +15 -0
  110. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/asap.js +109 -0
  111. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/config.js +28 -0
  112. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/defer.js +45 -0
  113. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/enumerator.js +125 -0
  114. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/events.js +201 -0
  115. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/filter.js +120 -0
  116. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash-settled.js +124 -0
  117. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash.js +94 -0
  118. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/instrument.js +41 -0
  119. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/map.js +99 -0
  120. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/node.js +281 -0
  121. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise-hash.js +51 -0
  122. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise.js +496 -0
  123. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/all.js +52 -0
  124. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/race.js +105 -0
  125. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/reject.js +47 -0
  126. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/resolve.js +49 -0
  127. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/race.js +15 -0
  128. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/reject.js +16 -0
  129. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/resolve.js +17 -0
  130. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/rethrow.js +46 -0
  131. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/utils.js +39 -0
  132. data/vendor/node_modules/traceur/node_modules/rsvp/package.json +100 -0
  133. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/README.md +9 -0
  134. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/bower.json +22 -0
  135. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/composer.json +18 -0
  136. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/package.json +52 -0
  137. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.amd.js +1607 -0
  138. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.js +1566 -0
  139. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.min.js +26 -0
  140. data/vendor/node_modules/traceur/node_modules/rsvp/vertx.js +1 -0
  141. data/vendor/node_modules/traceur/node_modules/semver/bin/semver +2 -2
  142. data/vendor/node_modules/traceur/node_modules/semver/package.json +4 -3
  143. data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js +7 -0
  144. data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js.gz +0 -0
  145. data/vendor/node_modules/traceur/node_modules/semver/semver.js +7 -0
  146. data/vendor/node_modules/traceur/node_modules/semver/semver.min.js +1 -1
  147. data/vendor/node_modules/traceur/node_modules/semver/semver.min.js.gz +0 -0
  148. data/vendor/node_modules/traceur/node_modules/semver/test/index.js +8 -4
  149. data/vendor/node_modules/traceur/node_modules/semver/test/ltr.js +2 -1
  150. data/vendor/node_modules/traceur/node_modules/source-map-support/.npmignore +1 -0
  151. data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/mime/LICENSE → source-map-support/LICENSE.md} +7 -5
  152. data/vendor/node_modules/traceur/node_modules/source-map-support/README.md +165 -0
  153. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/browser-source-map-support.js +89 -0
  154. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/index.html +6 -0
  155. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/require.js +36 -0
  156. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.coffee +13 -0
  157. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.js +24 -0
  158. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.map +10 -0
  159. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-source-map-support.js +89 -0
  160. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/index.html +6 -0
  161. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.coffee +12 -0
  162. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.js +25 -0
  163. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.map +10 -0
  164. data/vendor/node_modules/traceur/node_modules/source-map-support/build.js +69 -0
  165. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/index.html +6 -0
  166. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.coffee +12 -0
  167. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.js +25 -0
  168. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.map +10 -0
  169. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/server.js +45 -0
  170. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/.npmignore +2 -0
  171. data/vendor/node_modules/traceur/node_modules/{q-io → source-map-support/node_modules/source-map}/.travis.yml +1 -0
  172. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/CHANGELOG.md +121 -0
  173. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/LICENSE +28 -0
  174. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/Makefile.dryice.js +166 -0
  175. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/README.md +434 -0
  176. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/assert-shim.js +56 -0
  177. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/mini-require.js +152 -0
  178. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-source-map.jsm +20 -0
  179. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-utils.jsm +18 -0
  180. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-browser.js +8 -0
  181. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-source-map.jsm +6 -0
  182. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-utils.jsm +21 -0
  183. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-prefix.js +8 -0
  184. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-suffix.js +3 -0
  185. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map.js +8 -0
  186. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/array-set.js +97 -0
  187. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
  188. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64.js +42 -0
  189. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/binary-search.js +81 -0
  190. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-consumer.js +478 -0
  191. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-generator.js +380 -0
  192. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-node.js +371 -0
  193. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/util.js +205 -0
  194. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
  195. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/README.md +171 -0
  196. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
  197. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/intercept.js +36 -0
  198. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/package.json +37 -0
  199. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/package.json +142 -0
  200. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/run-tests.js +62 -0
  201. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-api.js +26 -0
  202. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-array-set.js +104 -0
  203. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
  204. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64.js +35 -0
  205. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
  206. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
  207. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-consumer.js +451 -0
  208. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-generator.js +417 -0
  209. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-node.js +365 -0
  210. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/util.js +161 -0
  211. data/vendor/node_modules/traceur/node_modules/source-map-support/package.json +52 -0
  212. data/vendor/node_modules/traceur/node_modules/source-map-support/source-map-support.js +381 -0
  213. data/vendor/node_modules/traceur/node_modules/source-map-support/test.js +359 -0
  214. data/vendor/node_modules/traceur/package.json +234 -20
  215. data/vendor/node_modules/traceur/src/node/NodeCompiler.js +78 -0
  216. data/vendor/node_modules/traceur/src/node/System.js +32 -5
  217. data/vendor/node_modules/traceur/src/node/api.js +28 -93
  218. data/vendor/node_modules/traceur/src/node/command.js +84 -19
  219. data/vendor/node_modules/traceur/src/node/compileAllJsFilesInDir.js +40 -0
  220. data/vendor/node_modules/traceur/src/node/interpreter.js +11 -8
  221. data/vendor/node_modules/traceur/src/node/recursiveModuleCompile.js +171 -0
  222. data/vendor/node_modules/traceur/src/node/require.js +7 -21
  223. data/vendor/node_modules/traceur/src/node/to-amd-compiler.js +2 -7
  224. data/vendor/node_modules/traceur/src/node/to-closure-compiler.js +28 -0
  225. data/vendor/node_modules/traceur/src/node/to-commonjs-compiler.js +3 -7
  226. data/vendor/node_modules/traceur/src/node/traceur.js +1 -1
  227. metadata +196 -190
  228. data/vendor/node_modules/traceur/node_modules/q-io/.npmignore +0 -1
  229. data/vendor/node_modules/traceur/node_modules/q-io/CHANGES.md +0 -122
  230. data/vendor/node_modules/traceur/node_modules/q-io/LICENSE +0 -19
  231. data/vendor/node_modules/traceur/node_modules/q-io/README.md +0 -928
  232. data/vendor/node_modules/traceur/node_modules/q-io/buffer-stream.js +0 -59
  233. data/vendor/node_modules/traceur/node_modules/q-io/coverage-report.js +0 -44
  234. data/vendor/node_modules/traceur/node_modules/q-io/deprecate.js +0 -51
  235. data/vendor/node_modules/traceur/node_modules/q-io/fs-boot.js +0 -307
  236. data/vendor/node_modules/traceur/node_modules/q-io/fs-common.js +0 -499
  237. data/vendor/node_modules/traceur/node_modules/q-io/fs-mock.js +0 -547
  238. data/vendor/node_modules/traceur/node_modules/q-io/fs-root.js +0 -105
  239. data/vendor/node_modules/traceur/node_modules/q-io/fs.js +0 -355
  240. data/vendor/node_modules/traceur/node_modules/q-io/fs2http.js +0 -65
  241. data/vendor/node_modules/traceur/node_modules/q-io/http-apps.js +0 -152
  242. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/chain.js +0 -24
  243. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/content.js +0 -93
  244. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/cookie.js +0 -154
  245. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/decorators.js +0 -178
  246. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/fs.js +0 -417
  247. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/html.js +0 -58
  248. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/json.js +0 -78
  249. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/negotiate.js +0 -120
  250. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/proxy.js +0 -27
  251. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/redirect.js +0 -209
  252. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/route.js +0 -125
  253. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/status.js +0 -175
  254. data/vendor/node_modules/traceur/node_modules/q-io/http-cookie.js +0 -75
  255. data/vendor/node_modules/traceur/node_modules/q-io/http.js +0 -378
  256. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.npmignore +0 -11
  257. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/CHANGES.md +0 -78
  258. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/LICENSE.md +0 -21
  259. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/README.md +0 -1285
  260. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/collections.js +0 -22
  261. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/dict.js +0 -142
  262. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-map.js +0 -57
  263. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-set.js +0 -183
  264. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-collection.js +0 -261
  265. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-map.js +0 -186
  266. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-order.js +0 -55
  267. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-set.js +0 -59
  268. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/heap.js +0 -236
  269. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/iterator.js +0 -371
  270. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/list.js +0 -435
  271. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js +0 -247
  272. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js +0 -147
  273. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/property-changes.js +0 -448
  274. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/range-changes.js +0 -139
  275. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-map.js +0 -79
  276. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-set.js +0 -142
  277. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/map.js +0 -60
  278. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/multi-map.js +0 -41
  279. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/package.json +0 -12
  280. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync +0 -7
  281. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync.patch +0 -48
  282. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/weak-map.js +0 -590
  283. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/package.json +0 -49
  284. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/set.js +0 -173
  285. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-array.js +0 -274
  286. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-function.js +0 -59
  287. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-object.js +0 -538
  288. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-regexp.js +0 -14
  289. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim.js +0 -6
  290. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-map.js +0 -49
  291. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-set.js +0 -51
  292. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array.js +0 -269
  293. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-map.js +0 -61
  294. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-set.js +0 -736
  295. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/tree-log.js +0 -40
  296. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/weak-map.js +0 -1
  297. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/README.md +0 -66
  298. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/mime.js +0 -114
  299. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/package.json +0 -35
  300. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/test.js +0 -84
  301. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/mime.types +0 -1588
  302. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/node.types +0 -77
  303. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/CHANGES +0 -15
  304. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/LICENSE +0 -19
  305. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/README +0 -96
  306. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/lib/mimeparse.js +0 -166
  307. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/package.json +0 -43
  308. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/CONTRIBUTING.md +0 -40
  309. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/LICENSE +0 -19
  310. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/README.md +0 -813
  311. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/compare-with-callbacks.js +0 -71
  312. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/scenarios.js +0 -36
  313. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/package.json +0 -93
  314. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/q.js +0 -1937
  315. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/queue.js +0 -35
  316. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/.gitmodules +0 -6
  317. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/History.md +0 -36
  318. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Makefile +0 -7
  319. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Readme.md +0 -38
  320. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/benchmark.js +0 -32
  321. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/examples.js +0 -39
  322. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/index.js +0 -2
  323. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/lib/querystring.js +0 -123
  324. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/package.json +0 -19
  325. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.gitmodules +0 -3
  326. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.npmignore +0 -3
  327. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/History.md +0 -128
  328. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Makefile +0 -53
  329. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Readme.md +0 -61
  330. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/bin/expresso +0 -856
  331. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/api.html +0 -1080
  332. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.html +0 -377
  333. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.md +0 -290
  334. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/foot.html +0 -3
  335. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/head.html +0 -42
  336. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/bar.js +0 -4
  337. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/foo.js +0 -16
  338. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/package.json +0 -12
  339. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/assert.test.js +0 -91
  340. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/async.test.js +0 -12
  341. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/bar.test.js +0 -13
  342. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/foo.test.js +0 -14
  343. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/http.test.js +0 -146
  344. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/async.test.js +0 -39
  345. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/http.test.js +0 -48
  346. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/.gitmodules +0 -3
  347. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/History.md +0 -22
  348. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Makefile +0 -6
  349. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Readme.md +0 -248
  350. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js +0 -53
  351. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/index.js +0 -2
  352. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/eql.js +0 -91
  353. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/should.js +0 -548
  354. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/package.json +0 -8
  355. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/test/should.test.js +0 -358
  356. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/test/querystring.test.js +0 -133
  357. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.npmignore +0 -3
  358. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/LICENSE.md +0 -20
  359. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/README.md +0 -33
  360. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/package.json +0 -37
  361. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/test/url2-spec.js +0 -125
  362. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/url2.js +0 -151
  363. data/vendor/node_modules/traceur/node_modules/q-io/package.json +0 -51
  364. data/vendor/node_modules/traceur/node_modules/q-io/reader.js +0 -133
  365. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/boot-directory-spec.js +0 -47
  366. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/contains-spec.js +0 -11
  367. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/fixtures/hello.txt +0 -1
  368. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/issues/1-spec.js +0 -33
  369. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/make-tree-spec.js +0 -92
  370. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/append-spec.js +0 -41
  371. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/copy-tree-spec.js +0 -57
  372. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/fixture/hello.txt +0 -1
  373. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/link-spec.js +0 -70
  374. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/make-tree-spec.js +0 -109
  375. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/merge-spec.js +0 -67
  376. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/move-spec.js +0 -219
  377. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/object-spec.js +0 -20
  378. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/range-spec.js +0 -26
  379. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/read-spec.js +0 -40
  380. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-directory-spec.js +0 -37
  381. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-tree-spec.js +0 -39
  382. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/root-spec.js +0 -32
  383. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/stat-spec.js +0 -26
  384. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/symbolic-link-spec.js +0 -86
  385. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/working-directory-spec.js +0 -31
  386. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/write-spec.js +0 -73
  387. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.js +0 -23
  388. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.txt +0 -1
  389. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/read-spec.js +0 -22
  390. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/relative-spec.js +0 -25
  391. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/reroot-spec.js +0 -45
  392. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/write-spec.js +0 -38
  393. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/cookie-spec.js +0 -52
  394. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/directory-list-spec.js +0 -86
  395. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/01234.txt +0 -1
  396. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/1234.txt +0 -1
  397. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/5678.txt +0 -0
  398. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/9012/3456.txt +0 -0
  399. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/hosts-spec.js +0 -49
  400. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/interpret-range-spec.js +0 -47
  401. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/partial-range-spec.js +0 -186
  402. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/proxy-spec.js +0 -82
  403. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/symbolic-link-spec.js +0 -110
  404. data/vendor/node_modules/traceur/node_modules/q-io/spec/http/agent-spec.js +0 -96
  405. data/vendor/node_modules/traceur/node_modules/q-io/spec/http/basic-spec.js +0 -96
  406. data/vendor/node_modules/traceur/node_modules/q-io/spec/lib/jasmine-promise.js +0 -42
  407. data/vendor/node_modules/traceur/node_modules/q-io/writer.js +0 -111
  408. data/vendor/node_modules/traceur/src/node/compile-single-file.js +0 -69
  409. data/vendor/node_modules/traceur/src/node/compiler.js +0 -116
  410. data/vendor/node_modules/traceur/src/node/inline-module.js +0 -149
@@ -107,8 +107,8 @@ function help () {
107
107
  ,""
108
108
  ,"-i --increment [<level>]"
109
109
  ," Increment a version by the specified level. Level can"
110
- ," be one of: major, minor, patch, or prerelease"
111
- ," Default level is 'patch'."
110
+ ," be one of: major, minor, patch, premajor, preminor,"
111
+ ," prepatch, or prerelease. Default level is 'patch'."
112
112
  ," Only one version may be specified."
113
113
  ,""
114
114
  ,"-l --loose"
@@ -0,0 +1,222 @@
1
+ 2.6.0 / 2014-12-30
2
+ ==================
3
+
4
+ * added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee
5
+ * Add application description to the help msg. Close #112 @dalssoft
6
+
7
+ 2.5.1 / 2014-12-15
8
+ ==================
9
+
10
+ * fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee
11
+
12
+ 2.5.0 / 2014-10-24
13
+ ==================
14
+
15
+ * add support for variadic arguments. Closes #277 @whitlockjc
16
+
17
+ 2.4.0 / 2014-10-17
18
+ ==================
19
+
20
+ * fixed a bug on executing the coercion function of subcommands option. Closes #270
21
+ * added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage
22
+ * added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage
23
+ * fixed a bug on subcommand name. Closes #248 @jonathandelgado
24
+ * fixed function normalize doesn’t honor option terminator. Closes #216 @abbr
25
+
26
+ 2.3.0 / 2014-07-16
27
+ ==================
28
+
29
+ * add command alias'. Closes PR #210
30
+ * fix: Typos. Closes #99
31
+ * fix: Unused fs module. Closes #217
32
+
33
+ 2.2.0 / 2014-03-29
34
+ ==================
35
+
36
+ * add passing of previous option value
37
+ * fix: support subcommands on windows. Closes #142
38
+ * Now the defaultValue passed as the second argument of the coercion function.
39
+
40
+ 2.1.0 / 2013-11-21
41
+ ==================
42
+
43
+ * add: allow cflag style option params, unit test, fixes #174
44
+
45
+ 2.0.0 / 2013-07-18
46
+ ==================
47
+
48
+ * remove input methods (.prompt, .confirm, etc)
49
+
50
+ 1.3.2 / 2013-07-18
51
+ ==================
52
+
53
+ * add support for sub-commands to co-exist with the original command
54
+
55
+ 1.3.1 / 2013-07-18
56
+ ==================
57
+
58
+ * add quick .runningCommand hack so you can opt-out of other logic when running a sub command
59
+
60
+ 1.3.0 / 2013-07-09
61
+ ==================
62
+
63
+ * add EACCES error handling
64
+ * fix sub-command --help
65
+
66
+ 1.2.0 / 2013-06-13
67
+ ==================
68
+
69
+ * allow "-" hyphen as an option argument
70
+ * support for RegExp coercion
71
+
72
+ 1.1.1 / 2012-11-20
73
+ ==================
74
+
75
+ * add more sub-command padding
76
+ * fix .usage() when args are present. Closes #106
77
+
78
+ 1.1.0 / 2012-11-16
79
+ ==================
80
+
81
+ * add git-style executable subcommand support. Closes #94
82
+
83
+ 1.0.5 / 2012-10-09
84
+ ==================
85
+
86
+ * fix `--name` clobbering. Closes #92
87
+ * fix examples/help. Closes #89
88
+
89
+ 1.0.4 / 2012-09-03
90
+ ==================
91
+
92
+ * add `outputHelp()` method.
93
+
94
+ 1.0.3 / 2012-08-30
95
+ ==================
96
+
97
+ * remove invalid .version() defaulting
98
+
99
+ 1.0.2 / 2012-08-24
100
+ ==================
101
+
102
+ * add `--foo=bar` support [arv]
103
+ * fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
104
+
105
+ 1.0.1 / 2012-08-03
106
+ ==================
107
+
108
+ * fix issue #56
109
+ * fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
110
+
111
+ 1.0.0 / 2012-07-05
112
+ ==================
113
+
114
+ * add support for optional option descriptions
115
+ * add defaulting of `.version()` to package.json's version
116
+
117
+ 0.6.1 / 2012-06-01
118
+ ==================
119
+
120
+ * Added: append (yes or no) on confirmation
121
+ * Added: allow node.js v0.7.x
122
+
123
+ 0.6.0 / 2012-04-10
124
+ ==================
125
+
126
+ * Added `.prompt(obj, callback)` support. Closes #49
127
+ * Added default support to .choose(). Closes #41
128
+ * Fixed the choice example
129
+
130
+ 0.5.1 / 2011-12-20
131
+ ==================
132
+
133
+ * Fixed `password()` for recent nodes. Closes #36
134
+
135
+ 0.5.0 / 2011-12-04
136
+ ==================
137
+
138
+ * Added sub-command option support [itay]
139
+
140
+ 0.4.3 / 2011-12-04
141
+ ==================
142
+
143
+ * Fixed custom help ordering. Closes #32
144
+
145
+ 0.4.2 / 2011-11-24
146
+ ==================
147
+
148
+ * Added travis support
149
+ * Fixed: line-buffered input automatically trimmed. Closes #31
150
+
151
+ 0.4.1 / 2011-11-18
152
+ ==================
153
+
154
+ * Removed listening for "close" on --help
155
+
156
+ 0.4.0 / 2011-11-15
157
+ ==================
158
+
159
+ * Added support for `--`. Closes #24
160
+
161
+ 0.3.3 / 2011-11-14
162
+ ==================
163
+
164
+ * Fixed: wait for close event when writing help info [Jerry Hamlet]
165
+
166
+ 0.3.2 / 2011-11-01
167
+ ==================
168
+
169
+ * Fixed long flag definitions with values [felixge]
170
+
171
+ 0.3.1 / 2011-10-31
172
+ ==================
173
+
174
+ * Changed `--version` short flag to `-V` from `-v`
175
+ * Changed `.version()` so it's configurable [felixge]
176
+
177
+ 0.3.0 / 2011-10-31
178
+ ==================
179
+
180
+ * Added support for long flags only. Closes #18
181
+
182
+ 0.2.1 / 2011-10-24
183
+ ==================
184
+
185
+ * "node": ">= 0.4.x < 0.7.0". Closes #20
186
+
187
+ 0.2.0 / 2011-09-26
188
+ ==================
189
+
190
+ * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
191
+
192
+ 0.1.0 / 2011-08-24
193
+ ==================
194
+
195
+ * Added support for custom `--help` output
196
+
197
+ 0.0.5 / 2011-08-18
198
+ ==================
199
+
200
+ * Changed: when the user enters nothing prompt for password again
201
+ * Fixed issue with passwords beginning with numbers [NuckChorris]
202
+
203
+ 0.0.4 / 2011-08-15
204
+ ==================
205
+
206
+ * Fixed `Commander#args`
207
+
208
+ 0.0.3 / 2011-08-15
209
+ ==================
210
+
211
+ * Added default option value support
212
+
213
+ 0.0.2 / 2011-08-15
214
+ ==================
215
+
216
+ * Added mask support to `Command#password(str[, mask], fn)`
217
+ * Added `Command#password(str, fn)`
218
+
219
+ 0.0.1 / 2010-01-03
220
+ ==================
221
+
222
+ * Initial release
@@ -1,8 +1,12 @@
1
1
  # Commander.js
2
2
 
3
- The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).
3
+ [![Build Status](https://api.travis-ci.org/tj/commander.js.svg)](http://travis-ci.org/tj/commander.js)
4
+ [![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
5
+ [![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
6
+
7
+ The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/tj/commander).
8
+ [API documentation](http://tj.github.com/commander.js/)
4
9
 
5
- [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)
6
10
 
7
11
  ## Installation
8
12
 
@@ -38,25 +42,6 @@ console.log(' - %s cheese', program.cheese);
38
42
 
39
43
  Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
40
44
 
41
- ## Automated --help
42
-
43
- The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
44
-
45
- ```
46
- $ ./examples/pizza --help
47
-
48
- Usage: pizza [options]
49
-
50
- Options:
51
-
52
- -V, --version output the version number
53
- -p, --peppers Add peppers
54
- -P, --pineapple Add pineapple
55
- -b, --bbq Add bbq sauce
56
- -c, --cheese <type> Add the specified type of cheese [marble]
57
- -h, --help output usage information
58
-
59
- ```
60
45
 
61
46
  ## Coercion
62
47
 
@@ -86,7 +71,7 @@ program
86
71
  .option('-r, --range <a>..<b>', 'A range', range)
87
72
  .option('-l, --list <items>', 'A list', list)
88
73
  .option('-o, --optional [value]', 'An optional value')
89
- .option('-c, --collect [value]', 'A repeatable value', [])
74
+ .option('-c, --collect [value]', 'A repeatable value', collect, [])
90
75
  .option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
91
76
  .parse(process.argv);
92
77
 
@@ -101,6 +86,78 @@ console.log(' verbosity: %j', program.verbose);
101
86
  console.log(' args: %j', program.args);
102
87
  ```
103
88
 
89
+ ## Variadic arguments
90
+
91
+ The last argument of a command can be variadic, and only the last argument. To make an argument variadic you have to
92
+ append `...` to the argument name. Here is an example:
93
+
94
+ ```js
95
+ #!/usr/bin/env node
96
+
97
+ /**
98
+ * Module dependencies.
99
+ */
100
+
101
+ var program = require('commander');
102
+
103
+ program
104
+ .version('0.0.1')
105
+ .command('rmdir <dir> [otherDirs...]')
106
+ .action(function (dir, otherDirs) {
107
+ console.log('rmdir %s', dir);
108
+ if (otherDirs) {
109
+ otherDirs.forEach(function (oDir) {
110
+ console.log('rmdir %s', oDir);
111
+ });
112
+ }
113
+ });
114
+
115
+ program.parse(process.argv);
116
+ ```
117
+
118
+ An `Array` is used for the value of a variadic argument. This applies to `program.args` as well as the argument passed
119
+ to your action as demonstrated above.
120
+
121
+ ## Git-style sub-commands
122
+
123
+ ```js
124
+ // file: ./examples/pm
125
+ var program = require('..');
126
+
127
+ program
128
+ .version('0.0.1')
129
+ .command('install [name]', 'install one or more packages')
130
+ .command('search [query]', 'search with optional query')
131
+ .command('list', 'list packages installed')
132
+ .parse(process.argv);
133
+ ```
134
+
135
+ When `.command()` is invoked with a description argument, no `.action(callback)` should be called to handle sub-commands, otherwise there will be an error. This tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools.
136
+ The commander will try to find the executable script in __current directory__ with the name `scriptBasename-subcommand`, like `pm-install`, `pm-search`.
137
+
138
+ ## Automated --help
139
+
140
+ The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
141
+
142
+ ```
143
+ $ ./examples/pizza --help
144
+
145
+ Usage: pizza [options]
146
+
147
+ An application for pizzas ordering
148
+
149
+ Options:
150
+
151
+ -h, --help output usage information
152
+ -V, --version output the version number
153
+ -p, --peppers Add peppers
154
+ -P, --pineapple Add pineapple
155
+ -b, --bbq Add bbq sauce
156
+ -c, --cheese <type> Add the specified type of cheese [marble]
157
+ -C, --no-cheese You do not want any cheese
158
+
159
+ ```
160
+
104
161
  ## Custom help
105
162
 
106
163
  You can display arbitrary `-h, --help` information
@@ -117,11 +174,7 @@ console.log(' args: %j', program.args);
117
174
  * Module dependencies.
118
175
  */
119
176
 
120
- var program = require('../');
121
-
122
- function list(val) {
123
- return val.split(',').map(Number);
124
- }
177
+ var program = require('commander');
125
178
 
126
179
  program
127
180
  .version('0.0.1')
@@ -145,7 +198,7 @@ program.parse(process.argv);
145
198
  console.log('stuff');
146
199
  ```
147
200
 
148
- yielding the following help output:
201
+ Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run:
149
202
 
150
203
  ```
151
204
 
@@ -174,15 +227,54 @@ Examples:
174
227
 
175
228
  Output help information and exit immediately.
176
229
 
177
- ## Links
230
+ ## Examples
231
+
232
+ ```js
233
+ var program = require('commander');
234
+
235
+ program
236
+ .version('0.0.1')
237
+ .option('-C, --chdir <path>', 'change the working directory')
238
+ .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
239
+ .option('-T, --no-tests', 'ignore test hook')
240
+
241
+ program
242
+ .command('setup [env]')
243
+ .description('run setup commands for all envs')
244
+ .option("-s, --setup_mode [mode]", "Which setup mode to use")
245
+ .action(function(env, options){
246
+ var mode = options.setup_mode || "normal";
247
+ env = env || 'all';
248
+ console.log('setup for %s env(s) with %s mode', env, mode);
249
+ });
250
+
251
+ program
252
+ .command('exec <cmd>')
253
+ .alias('ex')
254
+ .description('execute the given remote cmd')
255
+ .option("-e, --exec_mode <mode>", "Which exec mode to use")
256
+ .action(function(cmd, options){
257
+ console.log('exec "%s" using %s mode', cmd, options.exec_mode);
258
+ }).on('--help', function() {
259
+ console.log(' Examples:');
260
+ console.log();
261
+ console.log(' $ deploy exec sequential');
262
+ console.log(' $ deploy exec async');
263
+ console.log();
264
+ });
265
+
266
+ program
267
+ .command('*')
268
+ .action(function(env){
269
+ console.log('deploying "%s"', env);
270
+ });
271
+
272
+ program.parse(process.argv);
273
+ ```
178
274
 
179
- - [API documentation](http://visionmedia.github.com/commander.js/)
180
- - [ascii tables](https://github.com/LearnBoost/cli-table)
181
- - [progress bars](https://github.com/visionmedia/node-progress)
182
- - [more progress bars](https://github.com/substack/node-multimeter)
183
- - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)
275
+ You can see more Demos in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.
184
276
 
185
- ## License
277
+ ## License
186
278
 
187
279
  (The MIT License)
188
280
 
@@ -5,8 +5,6 @@
5
5
 
6
6
  var EventEmitter = require('events').EventEmitter;
7
7
  var spawn = require('child_process').spawn;
8
- var fs = require('fs');
9
- var exists = fs.existsSync;
10
8
  var path = require('path');
11
9
  var dirname = path.dirname;
12
10
  var basename = path.basename;
@@ -15,7 +13,7 @@ var basename = path.basename;
15
13
  * Expose the root command.
16
14
  */
17
15
 
18
- exports = module.exports = new Command;
16
+ exports = module.exports = new Command();
19
17
 
20
18
  /**
21
19
  * Expose `Command`.
@@ -55,7 +53,7 @@ function Option(flags, description) {
55
53
  * @api private
56
54
  */
57
55
 
58
- Option.prototype.name = function(){
56
+ Option.prototype.name = function() {
59
57
  return this.long
60
58
  .replace('--', '')
61
59
  .replace('no-', '');
@@ -69,9 +67,8 @@ Option.prototype.name = function(){
69
67
  * @api private
70
68
  */
71
69
 
72
- Option.prototype.is = function(arg){
73
- return arg == this.short
74
- || arg == this.long;
70
+ Option.prototype.is = function(arg) {
71
+ return arg == this.short || arg == this.long;
75
72
  };
76
73
 
77
74
  /**
@@ -85,6 +82,7 @@ function Command(name) {
85
82
  this.commands = [];
86
83
  this.options = [];
87
84
  this._execs = [];
85
+ this._allowUnknownOption = false;
88
86
  this._args = [];
89
87
  this._name = name;
90
88
  }
@@ -118,41 +116,58 @@ Command.prototype.__proto__ = EventEmitter.prototype;
118
116
  * program
119
117
  * .command('setup')
120
118
  * .description('run remote setup commands')
121
- * .action(function(){
119
+ * .action(function() {
122
120
  * console.log('setup');
123
121
  * });
124
122
  *
125
123
  * program
126
124
  * .command('exec <cmd>')
127
125
  * .description('run the given remote command')
128
- * .action(function(cmd){
126
+ * .action(function(cmd) {
129
127
  * console.log('exec "%s"', cmd);
130
128
  * });
131
129
  *
132
130
  * program
131
+ * .command('teardown <dir> [otherDirs...]')
132
+ * .description('run teardown commands')
133
+ * .action(function(dir, otherDirs) {
134
+ * console.log('dir "%s"', dir);
135
+ * if (otherDirs) {
136
+ * otherDirs.forEach(function (oDir) {
137
+ * console.log('dir "%s"', oDir);
138
+ * });
139
+ * }
140
+ * });
141
+ *
142
+ * program
133
143
  * .command('*')
134
144
  * .description('deploy the given env')
135
- * .action(function(env){
145
+ * .action(function(env) {
136
146
  * console.log('deploying "%s"', env);
137
147
  * });
138
148
  *
139
149
  * program.parse(process.argv);
140
150
  *
141
151
  * @param {String} name
142
- * @param {String} [desc]
152
+ * @param {String} [desc] for git-style sub-commands
143
153
  * @return {Command} the new command
144
154
  * @api public
145
155
  */
146
156
 
147
- Command.prototype.command = function(name, desc){
157
+ Command.prototype.command = function(name, desc) {
148
158
  var args = name.split(/ +/);
149
159
  var cmd = new Command(args.shift());
150
- if (desc) cmd.description(desc);
151
- if (desc) this.executables = true;
152
- if (desc) this._execs[cmd._name] = true;
160
+
161
+ if (desc) {
162
+ cmd.description(desc);
163
+ this.executables = true;
164
+ this._execs[cmd._name] = true;
165
+ }
166
+
153
167
  this.commands.push(cmd);
154
168
  cmd.parseExpectedArgs(args);
155
169
  cmd.parent = this;
170
+
156
171
  if (desc) return this;
157
172
  return cmd;
158
173
  };
@@ -178,18 +193,33 @@ Command.prototype.addImplicitHelpCommand = function() {
178
193
  * @api public
179
194
  */
180
195
 
181
- Command.prototype.parseExpectedArgs = function(args){
196
+ Command.prototype.parseExpectedArgs = function(args) {
182
197
  if (!args.length) return;
183
198
  var self = this;
184
- args.forEach(function(arg){
199
+ args.forEach(function(arg) {
200
+ var argDetails = {
201
+ required: false,
202
+ name: '',
203
+ variadic: false
204
+ };
205
+
185
206
  switch (arg[0]) {
186
207
  case '<':
187
- self._args.push({ required: true, name: arg.slice(1, -1) });
208
+ argDetails.required = true;
209
+ argDetails.name = arg.slice(1, -1);
188
210
  break;
189
211
  case '[':
190
- self._args.push({ required: false, name: arg.slice(1, -1) });
212
+ argDetails.name = arg.slice(1, -1);
191
213
  break;
192
214
  }
215
+
216
+ if (argDetails.name.length > 3 && argDetails.name.slice(-3) === '...') {
217
+ argDetails.variadic = true;
218
+ argDetails.name = argDetails.name.slice(0, -3);
219
+ }
220
+ if (argDetails.name) {
221
+ self._args.push(argDetails);
222
+ }
193
223
  });
194
224
  return this;
195
225
  };
@@ -202,7 +232,7 @@ Command.prototype.parseExpectedArgs = function(args){
202
232
  * program
203
233
  * .command('help')
204
234
  * .description('display verbose help')
205
- * .action(function(){
235
+ * .action(function() {
206
236
  * // output help here
207
237
  * });
208
238
  *
@@ -211,11 +241,13 @@ Command.prototype.parseExpectedArgs = function(args){
211
241
  * @api public
212
242
  */
213
243
 
214
- Command.prototype.action = function(fn){
244
+ Command.prototype.action = function(fn) {
215
245
  var self = this;
216
- this.parent.on(this._name, function(args, unknown){
246
+ var listener = function(args, unknown) {
217
247
  // Parse any so-far unknown options
248
+ args = args || [];
218
249
  unknown = unknown || [];
250
+
219
251
  var parsed = self.parseOptions(unknown);
220
252
 
221
253
  // Output help if necessary
@@ -231,9 +263,15 @@ Command.prototype.action = function(fn){
231
263
  // Leftover arguments need to be pushed back. Fixes issue #56
232
264
  if (parsed.args.length) args = parsed.args.concat(args);
233
265
 
234
- self._args.forEach(function(arg, i){
266
+ self._args.forEach(function(arg, i) {
235
267
  if (arg.required && null == args[i]) {
236
268
  self.missingArgument(arg.name);
269
+ } else if (arg.variadic) {
270
+ if (i !== self._args.length - 1) {
271
+ self.variadicArgNotLast(arg.name);
272
+ }
273
+
274
+ args[i] = args.splice(i);
237
275
  }
238
276
  });
239
277
 
@@ -246,8 +284,10 @@ Command.prototype.action = function(fn){
246
284
  args.push(self);
247
285
  }
248
286
 
249
- fn.apply(this, args);
250
- });
287
+ fn.apply(self, args);
288
+ };
289
+ this.parent.on(this._name, listener);
290
+ if (this._alias) this.parent.on(this._alias, listener);
251
291
  return this;
252
292
  };
253
293
 
@@ -272,7 +312,7 @@ Command.prototype.action = function(fn){
272
312
  * program.pepper
273
313
  * // => Boolean
274
314
  *
275
- * // simple boolean defaulting to false
315
+ * // simple boolean defaulting to true
276
316
  * program.option('-C, --no-cheese', 'remove cheese');
277
317
  *
278
318
  * program.cheese
@@ -280,7 +320,7 @@ Command.prototype.action = function(fn){
280
320
  *
281
321
  * --no-cheese
282
322
  * program.cheese
283
- * // => true
323
+ * // => false
284
324
  *
285
325
  * // required argument
286
326
  * program.option('-C, --chdir <path>', 'change the working directory');
@@ -300,14 +340,17 @@ Command.prototype.action = function(fn){
300
340
  * @api public
301
341
  */
302
342
 
303
- Command.prototype.option = function(flags, description, fn, defaultValue){
343
+ Command.prototype.option = function(flags, description, fn, defaultValue) {
304
344
  var self = this
305
345
  , option = new Option(flags, description)
306
346
  , oname = option.name()
307
347
  , name = camelcase(oname);
308
348
 
309
349
  // default as 3rd arg
310
- if ('function' != typeof fn) defaultValue = fn, fn = null;
350
+ if (typeof fn != 'function') {
351
+ defaultValue = fn;
352
+ fn = null;
353
+ }
311
354
 
312
355
  // preassign default value only for --no-*, [optional], or <required>
313
356
  if (false == option.bool || option.optional || option.required) {
@@ -322,9 +365,11 @@ Command.prototype.option = function(flags, description, fn, defaultValue){
322
365
 
323
366
  // when it's passed assign the value
324
367
  // and conditionally invoke the callback
325
- this.on(oname, function(val){
368
+ this.on(oname, function(val) {
326
369
  // coercion
327
- if (null !== val && fn) val = fn(val, undefined === self[name] ? defaultValue : self[name]);
370
+ if (null !== val && fn) val = fn(val, undefined === self[name]
371
+ ? defaultValue
372
+ : self[name]);
328
373
 
329
374
  // unassigned or bool
330
375
  if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {
@@ -345,6 +390,18 @@ Command.prototype.option = function(flags, description, fn, defaultValue){
345
390
  return this;
346
391
  };
347
392
 
393
+ /**
394
+ * Allow unknown options on the command line.
395
+ *
396
+ * @param {Boolean} arg if `true` or omitted, no error will be thrown
397
+ * for unknown options.
398
+ * @api public
399
+ */
400
+ Command.prototype.allowUnknownOption = function(arg) {
401
+ this._allowUnknownOption = arguments.length === 0 || arg;
402
+ return this;
403
+ };
404
+
348
405
  /**
349
406
  * Parse `argv`, settings options and invoking commands when defined.
350
407
  *
@@ -353,7 +410,7 @@ Command.prototype.option = function(flags, description, fn, defaultValue){
353
410
  * @api public
354
411
  */
355
412
 
356
- Command.prototype.parse = function(argv){
413
+ Command.prototype.parse = function(argv) {
357
414
  // implicit help
358
415
  if (this.executables) this.addImplicitHelpCommand();
359
416
 
@@ -371,7 +428,9 @@ Command.prototype.parse = function(argv){
371
428
 
372
429
  // executable sub-commands
373
430
  var name = result.args[0];
374
- if (this._execs[name]) return this.executeSubCommand(argv, args, parsed.unknown);
431
+ if (this._execs[name] && typeof this._execs[name] != "function") {
432
+ return this.executeSubCommand(argv, args, parsed.unknown);
433
+ }
375
434
 
376
435
  return result;
377
436
  };
@@ -408,7 +467,7 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
408
467
  args = args.slice(1);
409
468
  args.unshift(local);
410
469
  var proc = spawn('node', args, { stdio: 'inherit', customFds: [0, 1, 2] });
411
- proc.on('error', function(err){
470
+ proc.on('error', function(err) {
412
471
  if (err.code == "ENOENT") {
413
472
  console.error('\n %s(1) does not exist, try --help\n', bin);
414
473
  } else if (err.code == "EACCES") {
@@ -429,7 +488,7 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) {
429
488
  * @api private
430
489
  */
431
490
 
432
- Command.prototype.normalize = function(args){
491
+ Command.prototype.normalize = function(args) {
433
492
  var ret = []
434
493
  , arg
435
494
  , lastOpt
@@ -437,12 +496,18 @@ Command.prototype.normalize = function(args){
437
496
 
438
497
  for (var i = 0, len = args.length; i < len; ++i) {
439
498
  arg = args[i];
440
- i > 0 && (lastOpt = this.optionFor(args[i-1]));
499
+ if (i > 0) {
500
+ lastOpt = this.optionFor(args[i-1]);
501
+ }
441
502
 
442
- if (lastOpt && lastOpt.required) {
443
- ret.push(arg);
503
+ if (arg === '--') {
504
+ // Honor option terminator
505
+ ret = ret.concat(args.slice(i));
506
+ break;
507
+ } else if (lastOpt && lastOpt.required) {
508
+ ret.push(arg);
444
509
  } else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
445
- arg.slice(1).split('').forEach(function(c){
510
+ arg.slice(1).split('').forEach(function(c) {
446
511
  ret.push('-' + c);
447
512
  });
448
513
  } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {
@@ -467,10 +532,8 @@ Command.prototype.normalize = function(args){
467
532
  * @api private
468
533
  */
469
534
 
470
- Command.prototype.parseArgs = function(args, unknown){
471
- var cmds = this.commands
472
- , len = cmds.length
473
- , name;
535
+ Command.prototype.parseArgs = function(args, unknown) {
536
+ var name;
474
537
 
475
538
  if (args.length) {
476
539
  name = args[0];
@@ -500,7 +563,7 @@ Command.prototype.parseArgs = function(args, unknown){
500
563
  * @api private
501
564
  */
502
565
 
503
- Command.prototype.optionFor = function(arg){
566
+ Command.prototype.optionFor = function(arg) {
504
567
  for (var i = 0, len = this.options.length; i < len; ++i) {
505
568
  if (this.options[i].is(arg)) {
506
569
  return this.options[i];
@@ -517,7 +580,7 @@ Command.prototype.optionFor = function(arg){
517
580
  * @api public
518
581
  */
519
582
 
520
- Command.prototype.parseOptions = function(argv){
583
+ Command.prototype.parseOptions = function(argv) {
521
584
  var args = []
522
585
  , len = argv.length
523
586
  , literal
@@ -587,6 +650,23 @@ Command.prototype.parseOptions = function(argv){
587
650
  return { args: args, unknown: unknownOptions };
588
651
  };
589
652
 
653
+ /**
654
+ * Return an object containing options as key-value pairs
655
+ *
656
+ * @return {Object}
657
+ * @api public
658
+ */
659
+ Command.prototype.opts = function() {
660
+ var result = {}
661
+ , len = this.options.length;
662
+
663
+ for (var i = 0 ; i < len; i++) {
664
+ var key = this.options[i].name();
665
+ result[key] = key === 'version' ? this._version : this[key];
666
+ }
667
+ return result;
668
+ };
669
+
590
670
  /**
591
671
  * Argument `name` is missing.
592
672
  *
@@ -594,7 +674,7 @@ Command.prototype.parseOptions = function(argv){
594
674
  * @api private
595
675
  */
596
676
 
597
- Command.prototype.missingArgument = function(name){
677
+ Command.prototype.missingArgument = function(name) {
598
678
  console.error();
599
679
  console.error(" error: missing required argument `%s'", name);
600
680
  console.error();
@@ -609,7 +689,7 @@ Command.prototype.missingArgument = function(name){
609
689
  * @api private
610
690
  */
611
691
 
612
- Command.prototype.optionMissingArgument = function(option, flag){
692
+ Command.prototype.optionMissingArgument = function(option, flag) {
613
693
  console.error();
614
694
  if (flag) {
615
695
  console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag);
@@ -627,13 +707,27 @@ Command.prototype.optionMissingArgument = function(option, flag){
627
707
  * @api private
628
708
  */
629
709
 
630
- Command.prototype.unknownOption = function(flag){
710
+ Command.prototype.unknownOption = function(flag) {
711
+ if(this._allowUnknownOption) return;
631
712
  console.error();
632
713
  console.error(" error: unknown option `%s'", flag);
633
714
  console.error();
634
715
  process.exit(1);
635
716
  };
636
717
 
718
+ /**
719
+ * Variadic argument with `name` is not the last argument as required.
720
+ *
721
+ * @param {String} name
722
+ * @api private
723
+ */
724
+
725
+ Command.prototype.variadicArgNotLast = function(name) {
726
+ console.error();
727
+ console.error(" error: variadic arguments must be last `%s'", name);
728
+ console.error();
729
+ process.exit(1);
730
+ };
637
731
 
638
732
  /**
639
733
  * Set the program version to `str`.
@@ -647,32 +741,46 @@ Command.prototype.unknownOption = function(flag){
647
741
  * @api public
648
742
  */
649
743
 
650
- Command.prototype.version = function(str, flags){
744
+ Command.prototype.version = function(str, flags) {
651
745
  if (0 == arguments.length) return this._version;
652
746
  this._version = str;
653
747
  flags = flags || '-V, --version';
654
748
  this.option(flags, 'output the version number');
655
- this.on('version', function(){
656
- console.log(str);
749
+ this.on('version', function() {
750
+ process.stdout.write(str + '\n');
657
751
  process.exit(0);
658
752
  });
659
753
  return this;
660
754
  };
661
755
 
662
756
  /**
663
- * Set the description `str`.
757
+ * Set the description to `str`.
664
758
  *
665
759
  * @param {String} str
666
760
  * @return {String|Command}
667
761
  * @api public
668
762
  */
669
763
 
670
- Command.prototype.description = function(str){
764
+ Command.prototype.description = function(str) {
671
765
  if (0 == arguments.length) return this._description;
672
766
  this._description = str;
673
767
  return this;
674
768
  };
675
769
 
770
+ /**
771
+ * Set an alias for the command
772
+ *
773
+ * @param {String} alias
774
+ * @return {String|Command}
775
+ * @api public
776
+ */
777
+
778
+ Command.prototype.alias = function(alias) {
779
+ if (0 == arguments.length) return this._alias;
780
+ this._alias = alias;
781
+ return this;
782
+ };
783
+
676
784
  /**
677
785
  * Set / get the command usage `str`.
678
786
  *
@@ -681,17 +789,14 @@ Command.prototype.description = function(str){
681
789
  * @api public
682
790
  */
683
791
 
684
- Command.prototype.usage = function(str){
685
- var args = this._args.map(function(arg){
686
- return arg.required
687
- ? '<' + arg.name + '>'
688
- : '[' + arg.name + ']';
792
+ Command.prototype.usage = function(str) {
793
+ var args = this._args.map(function(arg) {
794
+ return humanReadableArgName(arg);
689
795
  });
690
796
 
691
- var usage = '[options'
692
- + (this.commands.length ? '] [command' : '')
693
- + ']'
694
- + (this._args.length ? ' ' + args : '');
797
+ var usage = '[options]'
798
+ + (this.commands.length ? ' [command]' : '')
799
+ + (this._args.length ? ' ' + args.join(' ') : '');
695
800
 
696
801
  if (0 == arguments.length) return this._usage || usage;
697
802
  this._usage = str;
@@ -699,6 +804,18 @@ Command.prototype.usage = function(str){
699
804
  return this;
700
805
  };
701
806
 
807
+ /**
808
+ * Get the name of the command
809
+ *
810
+ * @param {String} name
811
+ * @return {String|Command}
812
+ * @api public
813
+ */
814
+
815
+ Command.prototype.name = function(name) {
816
+ return this._name;
817
+ };
818
+
702
819
  /**
703
820
  * Return the largest option length.
704
821
  *
@@ -706,8 +823,8 @@ Command.prototype.usage = function(str){
706
823
  * @api private
707
824
  */
708
825
 
709
- Command.prototype.largestOptionLength = function(){
710
- return this.options.reduce(function(max, option){
826
+ Command.prototype.largestOptionLength = function() {
827
+ return this.options.reduce(function(max, option) {
711
828
  return Math.max(max, option.flags.length);
712
829
  }, 0);
713
830
  };
@@ -719,14 +836,13 @@ Command.prototype.largestOptionLength = function(){
719
836
  * @api private
720
837
  */
721
838
 
722
- Command.prototype.optionHelp = function(){
839
+ Command.prototype.optionHelp = function() {
723
840
  var width = this.largestOptionLength();
724
841
 
725
842
  // Prepend the help information
726
843
  return [pad('-h, --help', width) + ' ' + 'output usage information']
727
- .concat(this.options.map(function(option){
728
- return pad(option.flags, width)
729
- + ' ' + option.description;
844
+ .concat(this.options.map(function(option) {
845
+ return pad(option.flags, width) + ' ' + option.description;
730
846
  }))
731
847
  .join('\n');
732
848
  };
@@ -738,26 +854,37 @@ Command.prototype.optionHelp = function(){
738
854
  * @api private
739
855
  */
740
856
 
741
- Command.prototype.commandHelp = function(){
857
+ Command.prototype.commandHelp = function() {
742
858
  if (!this.commands.length) return '';
859
+
860
+ var commands = this.commands.map(function(cmd) {
861
+ var args = cmd._args.map(function(arg) {
862
+ return humanReadableArgName(arg);
863
+ }).join(' ');
864
+
865
+ return [
866
+ cmd._name
867
+ + (cmd._alias
868
+ ? '|' + cmd._alias
869
+ : '')
870
+ + (cmd.options.length
871
+ ? ' [options]'
872
+ : '')
873
+ + ' ' + args
874
+ , cmd.description()
875
+ ];
876
+ });
877
+
878
+ var width = commands.reduce(function(max, command) {
879
+ return Math.max(max, command[0].length);
880
+ }, 0);
881
+
743
882
  return [
744
883
  ''
745
884
  , ' Commands:'
746
885
  , ''
747
- , this.commands.map(function(cmd){
748
- var args = cmd._args.map(function(arg){
749
- return arg.required
750
- ? '<' + arg.name + '>'
751
- : '[' + arg.name + ']';
752
- }).join(' ');
753
-
754
- return pad(cmd._name
755
- + (cmd.options.length
756
- ? ' [options]'
757
- : '') + ' ' + args, 22)
758
- + (cmd.description()
759
- ? ' ' + cmd.description()
760
- : '');
886
+ , commands.map(function(cmd) {
887
+ return pad(cmd[0], width) + ' ' + cmd[1];
761
888
  }).join('\n').replace(/^/gm, ' ')
762
889
  , ''
763
890
  ].join('\n');
@@ -770,17 +897,42 @@ Command.prototype.commandHelp = function(){
770
897
  * @api private
771
898
  */
772
899
 
773
- Command.prototype.helpInformation = function(){
774
- return [
775
- ''
776
- , ' Usage: ' + this._name + ' ' + this.usage()
777
- , '' + this.commandHelp()
778
- , ' Options:'
900
+ Command.prototype.helpInformation = function() {
901
+ var desc = [];
902
+ if (this._description) {
903
+ desc = [
904
+ ' ' + this._description
905
+ , ''
906
+ ];
907
+ }
908
+
909
+ var cmdName = this._name;
910
+ if(this._alias) {
911
+ cmdName = cmdName + '|' + this._alias;
912
+ }
913
+ var usage = [
914
+ ''
915
+ ,' Usage: ' + cmdName + ' ' + this.usage()
916
+ , ''
917
+ ];
918
+
919
+ var cmds = [];
920
+ var commandHelp = this.commandHelp();
921
+ if (commandHelp) cmds = [commandHelp];
922
+
923
+ var options = [
924
+ ' Options:'
779
925
  , ''
780
926
  , '' + this.optionHelp().replace(/^/gm, ' ')
781
927
  , ''
782
928
  , ''
783
- ].join('\n');
929
+ ];
930
+
931
+ return usage
932
+ .concat(cmds)
933
+ .concat(desc)
934
+ .concat(options)
935
+ .join('\n');
784
936
  };
785
937
 
786
938
  /**
@@ -789,7 +941,7 @@ Command.prototype.helpInformation = function(){
789
941
  * @api public
790
942
  */
791
943
 
792
- Command.prototype.outputHelp = function(){
944
+ Command.prototype.outputHelp = function() {
793
945
  process.stdout.write(this.helpInformation());
794
946
  this.emit('--help');
795
947
  };
@@ -800,7 +952,7 @@ Command.prototype.outputHelp = function(){
800
952
  * @api public
801
953
  */
802
954
 
803
- Command.prototype.help = function(){
955
+ Command.prototype.help = function() {
804
956
  this.outputHelp();
805
957
  process.exit();
806
958
  };
@@ -814,7 +966,7 @@ Command.prototype.help = function(){
814
966
  */
815
967
 
816
968
  function camelcase(flag) {
817
- return flag.split('-').reduce(function(str, word){
969
+ return flag.split('-').reduce(function(str, word) {
818
970
  return str + word[0].toUpperCase() + word.slice(1);
819
971
  });
820
972
  }
@@ -850,3 +1002,19 @@ function outputHelpIfNecessary(cmd, options) {
850
1002
  }
851
1003
  }
852
1004
  }
1005
+
1006
+ /**
1007
+ * Takes an argument an returns its human readable equivalent for help usage.
1008
+ *
1009
+ * @param {Object} arg
1010
+ * @return {String}
1011
+ * @api private
1012
+ */
1013
+
1014
+ function humanReadableArgName(arg) {
1015
+ var nameOutput = arg.name + (arg.variadic === true ? '...' : '');
1016
+
1017
+ return arg.required
1018
+ ? '<' + nameOutput + '>'
1019
+ : '[' + nameOutput + ']'
1020
+ }