├── .editorconfig ├── .eslintignore ├── .eslintrc ├── .gitattributes ├── .github ├── CODEOWNERS ├── dependabot.yml └── workflows │ ├── automerge.yml │ ├── failureNotifications.yml │ ├── manualRelease.yml │ ├── notify-slack-on-pr-open.yml │ ├── onPushToMain.yml │ ├── onRelease.yml │ └── test.yml ├── .gitignore ├── .mocharc.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── bin ├── run └── run.cmd ├── example ├── ls.ts └── tsconfig.json ├── flush.d.ts ├── flush.js ├── git2gus └── config.json ├── package.json ├── src ├── command.ts ├── flags.ts ├── index.ts ├── main.ts └── util.ts ├── test ├── command.test.ts ├── helpers │ ├── init.js │ ├── test-help-in-lib │ │ └── lib │ │ │ └── test-help-plugin.js │ └── test-help-in-src │ │ ├── src │ │ └── test-help-plugin.ts │ │ └── tsconfig.json ├── main.test.ts └── tsconfig.json ├── tsconfig.json └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /lib 2 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "oclif", 4 | "oclif-typescript" 5 | ], 6 | "rules": { 7 | "unicorn/prefer-node-protocol": "off", 8 | "node/no-missing-import": "off", 9 | "@typescript-eslint/no-empty-function": "off", 10 | "unicorn/prefer-module": "off", 11 | "unicorn/prefer-regexp-test": "off", 12 | "default-param-last": "off", 13 | "unicorn/prefer-array-some": "off", 14 | "unicorn/consistent-function-scoping": "off", 15 | "unicorn/import-style": "off" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.js text eol=lf 3 | *.ts text eol=lf 4 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @heroku/cli 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: 'npm' 4 | directory: '/' 5 | schedule: 6 | interval: 'weekly' 7 | day: 'saturday' 8 | versioning-strategy: 'increase' 9 | labels: 10 | - 'dependencies' 11 | open-pull-requests-limit: 5 12 | pull-request-branch-name: 13 | separator: '-' 14 | commit-message: 15 | # cause a release for non-dev-deps 16 | prefix: fix(deps) 17 | # no release for dev-deps 18 | prefix-development: chore(dev-deps) 19 | ignore: 20 | - dependency-name: '@salesforce/dev-scripts' 21 | - dependency-name: '*' 22 | update-types: ['version-update:semver-major'] 23 | -------------------------------------------------------------------------------- /.github/workflows/automerge.yml: -------------------------------------------------------------------------------- 1 | name: automerge 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | - cron: '17 2,5,8,11 * * *' 6 | 7 | jobs: 8 | automerge: 9 | uses: oclif/github-workflows/.github/workflows/automerge.yml@main 10 | secrets: inherit 11 | -------------------------------------------------------------------------------- /.github/workflows/failureNotifications.yml: -------------------------------------------------------------------------------- 1 | name: failureNotifications 2 | 3 | on: 4 | workflow_run: 5 | workflows: 6 | - version, tag and github release 7 | - publish 8 | types: 9 | - completed 10 | 11 | jobs: 12 | failure-notify: 13 | runs-on: ubuntu-latest 14 | if: ${{ github.event.workflow_run.conclusion == 'failure' }} 15 | steps: 16 | - name: Announce Failure 17 | id: slack 18 | uses: slackapi/slack-github-action@v1.21.0 19 | env: 20 | # for non-CLI-team-owned plugins, you can send this anywhere you like 21 | SLACK_WEBHOOK_URL: ${{ secrets.CLI_ALERTS_SLACK_WEBHOOK }} 22 | SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK 23 | with: 24 | payload: | 25 | { 26 | "text": "${{ github.event.workflow_run.name }} failed: ${{ github.event.workflow_run.repository.name }}", 27 | "blocks": [ 28 | { 29 | "type": "header", 30 | "text": { 31 | "type": "plain_text", 32 | "text": ":bh-alert: ${{ github.event.workflow_run.name }} failed: ${{ github.event.workflow_run.repository.name }} :bh-alert:" 33 | } 34 | }, 35 | { 36 | "type": "section", 37 | "text": { 38 | "type": "mrkdwn", 39 | "text": "Repo: ${{ github.event.workflow_run.repository.html_url }}\nWorkflow name: `${{ github.event.workflow_run.name }}`\nJob url: ${{ github.event.workflow_run.html_url }}" 40 | } 41 | } 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /.github/workflows/manualRelease.yml: -------------------------------------------------------------------------------- 1 | name: manual release 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | release: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v3 11 | with: 12 | token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 13 | - name: Conventional Changelog Action 14 | id: changelog 15 | uses: TriPSs/conventional-changelog-action@d360fad3a42feca6462f72c97c165d60a02d4bf2 16 | # overriding some of the basic behaviors to just get the changelog 17 | with: 18 | git-user-name: svc-cli-bot 19 | git-user-email: svc_cli_bot@salesforce.com 20 | github-token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 21 | output-file: false 22 | # always do the release, even if there are no semantic commits 23 | skip-on-empty: false 24 | tag-prefix: '' 25 | - uses: notiz-dev/github-action-json-property@2192e246737701f108a4571462b76c75e7376216 26 | id: packageVersion 27 | with: 28 | path: 'package.json' 29 | prop_path: 'version' 30 | - name: Create Github Release 31 | uses: actions/create-release@v1 32 | env: 33 | GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 34 | with: 35 | tag_name: ${{ steps.packageVersion.outputs.prop }} 36 | release_name: ${{ steps.packageVersion.outputs.prop }} 37 | -------------------------------------------------------------------------------- /.github/workflows/notify-slack-on-pr-open.yml: -------------------------------------------------------------------------------- 1 | name: Pull Request Slack Notification 2 | 3 | on: 4 | pull_request: 5 | types: [opened, reopened] 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Notify Slack on PR open 12 | env: 13 | WEBHOOK_URL : ${{ secrets.CLI_TEAM_SLACK_WEBHOOK_URL }} 14 | PULL_REQUEST_AUTHOR_ICON_URL : ${{ github.event.pull_request.user.avatar_url }} 15 | PULL_REQUEST_AUTHOR_NAME : ${{ github.event.pull_request.user.login }} 16 | PULL_REQUEST_AUTHOR_PROFILE_URL: ${{ github.event.pull_request.user.html_url }} 17 | PULL_REQUEST_BASE_BRANCH_NAME : ${{ github.event.pull_request.base.ref }} 18 | PULL_REQUEST_COMPARE_BRANCH_NAME : ${{ github.event.pull_request.head.ref }} 19 | PULL_REQUEST_NUMBER : ${{ github.event.pull_request.number }} 20 | PULL_REQUEST_REPO: ${{ github.event.pull_request.head.repo.name }} 21 | PULL_REQUEST_TITLE : ${{ github.event.pull_request.title }} 22 | PULL_REQUEST_URL : ${{ github.event.pull_request.html_url }} 23 | uses: salesforcecli/github-workflows/.github/actions/prNotification@main 24 | -------------------------------------------------------------------------------- /.github/workflows/onPushToMain.yml: -------------------------------------------------------------------------------- 1 | # test 2 | name: version, tag and github release 3 | 4 | on: 5 | push: 6 | branches: [main] 7 | 8 | jobs: 9 | release: 10 | uses: oclif/github-workflows/.github/workflows/githubRelease.yml@main 11 | secrets: inherit 12 | 13 | # most repos won't use this 14 | # depends on previous job to avoid git collisions, not for any functionality reason 15 | # docs: 16 | # uses: salesforcecli/github-workflows/.github/workflows/publishTypedoc.yml@main 17 | # secrets: inherit 18 | # needs: release 19 | -------------------------------------------------------------------------------- /.github/workflows/onRelease.yml: -------------------------------------------------------------------------------- 1 | name: publish 2 | 3 | on: 4 | release: 5 | types: [released] 6 | # support manual release in case something goes wrong and needs to be repeated or tested 7 | workflow_dispatch: 8 | inputs: 9 | tag: 10 | description: tag that needs to publish 11 | type: string 12 | required: true 13 | jobs: 14 | npm: 15 | uses: oclif/github-workflows/.github/workflows/npmPublish.yml@main 16 | with: 17 | tag: latest 18 | githubTag: ${{ github.event.release.tag_name || inputs.tag }} 19 | secrets: inherit 20 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: tests 2 | on: 3 | push: 4 | branches-ignore: [main] 5 | workflow_dispatch: 6 | 7 | jobs: 8 | unit-tests: 9 | uses: oclif/github-workflows/.github/workflows/unitTest.yml@main 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *-debug.log 2 | *-error.log 3 | /.nyc_output 4 | /coverage 5 | /coverage.lcov 6 | /lib 7 | /node_modules 8 | /tmp 9 | -------------------------------------------------------------------------------- /.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": [ 3 | "test/helpers/init.js", 4 | "ts-node/register", 5 | "source-map-support/register" 6 | ], 7 | "watch-extensions": [ 8 | "ts" 9 | ], 10 | "recursive": true, 11 | "reporter": "spec", 12 | "timeout": 60000 13 | } 14 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [1.8.36](https://github.com/oclif/command/compare/1.8.35...1.8.36) (2023-08-19) 2 | 3 | 4 | ### Bug Fixes 5 | 6 | * **deps:** bump @oclif/parser from 3.8.16 to 3.8.17 ([272a96a](https://github.com/oclif/command/commit/272a96ab4c34eaf6e1c7263afecfab2160db9b2b)) 7 | 8 | 9 | 10 | ## [1.8.35](https://github.com/oclif/command/compare/1.8.34...1.8.35) (2023-07-29) 11 | 12 | 13 | ### Bug Fixes 14 | 15 | * **deps:** bump @oclif/parser from 3.8.15 to 3.8.16 ([1b45710](https://github.com/oclif/command/commit/1b4571000a166969767b6dc474098f67a9a087f6)) 16 | 17 | 18 | 19 | ## [1.8.34](https://github.com/oclif/command/compare/1.8.33...1.8.34) (2023-07-22) 20 | 21 | 22 | ### Bug Fixes 23 | 24 | * **deps:** bump @oclif/parser from 3.8.14 to 3.8.15 ([ebd6c15](https://github.com/oclif/command/commit/ebd6c158a8c57bb0d4c49d9dd6d9b2327de2382d)) 25 | 26 | 27 | 28 | ## [1.8.33](https://github.com/oclif/command/compare/1.8.32...1.8.33) (2023-07-19) 29 | 30 | 31 | ### Bug Fixes 32 | 33 | * **deps:** bump word-wrap from 1.2.3 to 1.2.4 ([01d25ee](https://github.com/oclif/command/commit/01d25ee4133860db7c3044c1b1320a85014a54ab)) 34 | 35 | 36 | 37 | ## [1.8.32](https://github.com/oclif/command/compare/1.8.31...1.8.32) (2023-07-15) 38 | 39 | 40 | ### Bug Fixes 41 | 42 | * **deps:** bump @oclif/parser from 3.8.13 to 3.8.14 ([74ddd29](https://github.com/oclif/command/commit/74ddd2938b9fa5be48926211f86c3c7fec95ddef)) 43 | 44 | 45 | 46 | ## [1.8.31](https://github.com/oclif/command/compare/1.8.30...1.8.31) (2023-07-08) 47 | 48 | 49 | ### Bug Fixes 50 | 51 | * **deps:** bump semver from 7.5.3 to 7.5.4 ([ec60a30](https://github.com/oclif/command/commit/ec60a3086cded9adfdc7964d07b143b3c8b04cfe)) 52 | 53 | 54 | 55 | ## [1.8.30](https://github.com/oclif/command/compare/1.8.29...1.8.30) (2023-07-01) 56 | 57 | 58 | ### Bug Fixes 59 | 60 | * **deps:** bump @oclif/parser from 3.8.12 to 3.8.13 ([1d815b8](https://github.com/oclif/command/commit/1d815b86e86c1b06a32732e757aa0362595fb851)) 61 | 62 | 63 | 64 | ## [1.8.29](https://github.com/oclif/command/compare/1.8.28...1.8.29) (2023-06-24) 65 | 66 | 67 | ### Bug Fixes 68 | 69 | * **deps:** bump semver from 7.5.2 to 7.5.3 ([288643f](https://github.com/oclif/command/commit/288643f9dce94a866ee814b9ac8394c22f3e7e2a)) 70 | 71 | 72 | 73 | ## [1.8.28](https://github.com/oclif/command/compare/1.8.27...1.8.28) (2023-06-17) 74 | 75 | 76 | ### Bug Fixes 77 | 78 | * **deps:** bump semver from 7.5.1 to 7.5.2 ([ff56716](https://github.com/oclif/command/commit/ff567168195b7448823fb549ba92a4c1757e8411)) 79 | 80 | 81 | 82 | ## [1.8.27](https://github.com/oclif/command/compare/1.8.26...1.8.27) (2023-06-03) 83 | 84 | 85 | ### Bug Fixes 86 | 87 | * **deps:** bump @oclif/parser from 3.8.11 to 3.8.12 ([790fe0a](https://github.com/oclif/command/commit/790fe0a69b22de2d56dea0ed1689ad3955e0e2df)) 88 | 89 | 90 | 91 | ## [1.8.26](https://github.com/oclif/command/compare/1.8.25...1.8.26) (2023-05-20) 92 | 93 | 94 | ### Bug Fixes 95 | 96 | * **deps:** bump @oclif/parser from 3.8.10 to 3.8.11 ([9bb228f](https://github.com/oclif/command/commit/9bb228f1e2772459cee4eace716c9981630ddc28)) 97 | 98 | 99 | 100 | ## [1.8.25](https://github.com/oclif/command/compare/1.8.24...1.8.25) (2023-05-13) 101 | 102 | 103 | ### Bug Fixes 104 | 105 | * **deps:** bump semver and @types/semver ([72c1cf6](https://github.com/oclif/command/commit/72c1cf65375bf1402c8145b12b50181adc2b640e)) 106 | 107 | 108 | 109 | ## [1.8.24](https://github.com/oclif/command/compare/1.8.23...1.8.24) (2023-04-22) 110 | 111 | 112 | ### Bug Fixes 113 | 114 | * **deps:** bump semver from 7.4.0 to 7.5.0 ([7de2e78](https://github.com/oclif/command/commit/7de2e78bc404bc661306946bf722d3493044e4ca)) 115 | 116 | 117 | 118 | ## [1.8.23](https://github.com/oclif/command/compare/1.8.22...1.8.23) (2023-04-15) 119 | 120 | 121 | ### Bug Fixes 122 | 123 | * **deps:** bump semver from 7.3.8 to 7.4.0 ([84b05a5](https://github.com/oclif/command/commit/84b05a5db1ad3458b79d048853b007e82f0189e4)) 124 | 125 | 126 | 127 | ## [1.8.22](https://github.com/oclif/command/compare/1.8.21...1.8.22) (2023-01-28) 128 | 129 | 130 | ### Bug Fixes 131 | 132 | * **deps:** bump @oclif/parser from 3.8.9 to 3.8.10 ([62a4a05](https://github.com/oclif/command/commit/62a4a0599128490fff53b276da6269a469ee1f2a)) 133 | 134 | 135 | 136 | ## [1.8.21](https://github.com/oclif/command/compare/1.8.20...1.8.21) (2023-01-08) 137 | 138 | 139 | ### Bug Fixes 140 | 141 | * **deps:** bump json5 from 2.2.0 to 2.2.3 ([29dda73](https://github.com/oclif/command/commit/29dda733e3926e9c7659515907ebbccb60045396)) 142 | 143 | 144 | 145 | ## [1.8.20](https://github.com/oclif/command/compare/1.8.19...1.8.20) (2022-11-05) 146 | 147 | 148 | ### Bug Fixes 149 | 150 | * **deps:** bump @oclif/parser from 3.8.8 to 3.8.9 ([5352853](https://github.com/oclif/command/commit/535285337a8192fc4d23ab98f587965f3ba5b64b)) 151 | 152 | 153 | 154 | ## [1.8.19](https://github.com/oclif/command/compare/1.8.18...1.8.19) (2022-10-29) 155 | 156 | 157 | ### Bug Fixes 158 | 159 | * **deps:** bump semver and @types/semver ([6904df8](https://github.com/oclif/command/commit/6904df82f9aab7b43455f537b05a895b3295b775)) 160 | 161 | 162 | 163 | ## [1.8.18](https://github.com/oclif/command/compare/1.8.17...1.8.18) (2022-10-01) 164 | 165 | 166 | ### Bug Fixes 167 | 168 | * **deps:** bump @oclif/parser from 3.8.6 to 3.8.8 ([db059a8](https://github.com/oclif/command/commit/db059a86230509e635b1e76d62f5bf14d63efb10)) 169 | 170 | 171 | 172 | ## [1.8.17](https://github.com/oclif/command/compare/v1.8.16...1.8.17) (2022-10-01) 173 | 174 | 175 | ### Bug Fixes 176 | 177 | * **deps:** bump @oclif/errors from 1.3.5 to 1.3.6 ([24becba](https://github.com/oclif/command/commit/24becbad506d8339ae3185d19a8425ae39b64b12)) 178 | 179 | 180 | 181 | ## [1.8.16](https://github.com/oclif/command/compare/v1.8.15...v1.8.16) (2021-12-17) 182 | 183 | 184 | 185 | ## [1.8.15](https://github.com/oclif/command/compare/v1.8.14...v1.8.15) (2021-12-14) 186 | 187 | 188 | ### Bug Fixes 189 | 190 | * bump @oclif/help ([#303](https://github.com/oclif/command/issues/303)) ([d088346](https://github.com/oclif/command/commit/d0883463de1de61fb77211713642f2198ace1c84)) 191 | 192 | 193 | 194 | ## [1.8.14](https://github.com/oclif/command/compare/v1.8.13...v1.8.14) (2021-12-14) 195 | 196 | 197 | ### Bug Fixes 198 | 199 | * remove @oclif/plugin-help ([#302](https://github.com/oclif/command/issues/302)) ([3a00d2a](https://github.com/oclif/command/commit/3a00d2a212f2e5848634110efbbf10f97e39c1cb)) 200 | 201 | 202 | 203 | ## [1.8.13](https://github.com/oclif/command/compare/v1.8.12...v1.8.13) (2021-12-10) 204 | 205 | 206 | ### Bug Fixes 207 | 208 | * bump deps ([#298](https://github.com/oclif/command/issues/298)) ([938a11c](https://github.com/oclif/command/commit/938a11c4ddaa03e60c7682f5a90a1a8d62d96288)) 209 | * recursive installation failure due to dep cycle ([18af8a4](https://github.com/oclif/command/commit/18af8a4f042593189b50d4663771867a854da09c)) 210 | 211 | 212 | 213 | ## [1.8.12](https://github.com/oclif/command/compare/v1.8.11...v1.8.12) (2021-12-09) 214 | 215 | 216 | ### Bug Fixes 217 | 218 | * bump plugin-help versions ([#297](https://github.com/oclif/command/issues/297)) ([1af07cd](https://github.com/oclif/command/commit/1af07cd6c9df6a3a962cf5200c9470a63de7a815)) 219 | * bump version to 1.8.12 ([32d9d93](https://github.com/oclif/command/commit/32d9d93395dcea80cbed959e72a31522750f015e)) 220 | 221 | 222 | 223 | ## [1.8.11](https://github.com/oclif/command/compare/v1.8.10...v1.8.11) (2021-12-09) 224 | 225 | 226 | ### Bug Fixes 227 | 228 | * bump deps ([#296](https://github.com/oclif/command/issues/296)) ([9daa780](https://github.com/oclif/command/commit/9daa780cd6b8cb0ecae757c0fd84b830a748572d)) 229 | 230 | 231 | 232 | ## [1.8.10](https://github.com/oclif/command/compare/v1.8.9...v1.8.10) (2021-12-08) 233 | 234 | 235 | ### Bug Fixes 236 | 237 | * remove transient dep on lodash.template ([#295](https://github.com/oclif/command/issues/295)) ([77e135c](https://github.com/oclif/command/commit/77e135c0470f45f90c1b358c6542ebe7273553ec)) 238 | 239 | 240 | 241 | ## [1.8.9](https://github.com/oclif/command/compare/v1.8.8...v1.8.9) (2021-12-06) 242 | 243 | 244 | ### Bug Fixes 245 | 246 | * more dep bumps ([#289](https://github.com/oclif/command/issues/289)) ([468abae](https://github.com/oclif/command/commit/468abae0ca09d769e74be61b593022c46324d85a)) 247 | 248 | 249 | 250 | ## [1.8.8](https://github.com/oclif/command/compare/v1.8.7...v1.8.8) (2021-12-06) 251 | 252 | 253 | ### Bug Fixes 254 | 255 | * bump-deps ([#283](https://github.com/oclif/command/issues/283)) ([4c7aee6](https://github.com/oclif/command/commit/4c7aee6d03ba57371279a3044877c0ce996bf669)) 256 | 257 | 258 | 259 | ## [1.8.7](https://github.com/oclif/command/compare/v1.8.6...v1.8.7) (2021-12-01) 260 | 261 | 262 | ### Bug Fixes 263 | 264 | * bump deps ([#282](https://github.com/oclif/command/issues/282)) ([5504b70](https://github.com/oclif/command/commit/5504b700b7ac4b876fd966b647dd4143931d1a19)) 265 | 266 | 267 | 268 | ## [1.8.6](https://github.com/oclif/command/compare/v1.8.5...v1.8.6) (2021-11-29) 269 | 270 | 271 | ### Bug Fixes 272 | 273 | * bump once more ([#277](https://github.com/oclif/command/issues/277)) ([23ffce7](https://github.com/oclif/command/commit/23ffce74ce02285f664b2bbc02748411dbf1c7f1)) 274 | 275 | 276 | 277 | ## [1.8.5](https://github.com/oclif/command/compare/v1.8.4...v1.8.5) (2021-11-29) 278 | 279 | 280 | ### Bug Fixes 281 | 282 | * remove lodash.template transitive dep ([#274](https://github.com/oclif/command/issues/274)) ([6211a83](https://github.com/oclif/command/commit/6211a834478620e20a388f90639b35052e612d24)) 283 | 284 | 285 | 286 | ## [1.8.4](https://github.com/oclif/command/compare/v1.8.3...v1.8.4) (2021-11-23) 287 | 288 | 289 | ### Bug Fixes 290 | 291 | * remove dep on lodash.template ([#271](https://github.com/oclif/command/issues/271)) ([2eb9002](https://github.com/oclif/command/commit/2eb900247cd026a5fc240bf0855f420ed48c775f)) 292 | 293 | 294 | 295 | ## [1.8.3](https://github.com/oclif/command/compare/v1.8.0...v1.8.3) (2021-11-18) 296 | 297 | 298 | ### Bug Fixes 299 | 300 | * apply sf orb for circle ([#270](https://github.com/oclif/command/issues/270)) ([d24409b](https://github.com/oclif/command/commit/d24409badb713418132c684b1d1e51538804a826)) 301 | * bump plugin-help version ([#268](https://github.com/oclif/command/issues/268)) ([ddfe384](https://github.com/oclif/command/commit/ddfe384cad8158d53d3be3112828598d60a0aa35)) 302 | * circular dependencies ([#165](https://github.com/oclif/command/issues/165)) ([780e1df](https://github.com/oclif/command/commit/780e1df947fd26f01786e19898436bce34b58ea4)) 303 | * force a release ([443d94f](https://github.com/oclif/command/commit/443d94f05a3427bfac7d9545b8ee0ef86dae2585)) 304 | * force release ([e2eaff3](https://github.com/oclif/command/commit/e2eaff3906d6b2e7b7e99857916e5f2072d2f924)) 305 | 306 | 307 | 308 | # [1.8.0](https://github.com/oclif/command/compare/v1.7.0...v1.8.0) (2020-08-03) 309 | 310 | 311 | ### Features 312 | 313 | * support src/command/index cmd ([#141](https://github.com/oclif/command/issues/141)) ([90ac072](https://github.com/oclif/command/commit/90ac07256b3d43577a8db7df0cfadb49e5925a4c)) 314 | 315 | 316 | 317 | # [1.7.0](https://github.com/oclif/command/compare/v1.6.1...v1.7.0) (2020-06-29) 318 | 319 | 320 | ### Features 321 | 322 | * add pretty printable interface to methods on command ([#96](https://github.com/oclif/command/issues/96)) ([2db646d](https://github.com/oclif/command/commit/2db646d553a4251135f9f6976d46c14b59b18b34)) 323 | * add types for flush ([#94](https://github.com/oclif/command/issues/94)) ([492cadb](https://github.com/oclif/command/commit/492cadb789b0c27ec54b9fca756ba6b7208f367f)) 324 | 325 | 326 | 327 | ## [1.6.1](https://github.com/oclif/command/compare/v1.6.0...v1.6.1) (2020-05-05) 328 | 329 | 330 | ### Bug Fixes 331 | 332 | * use args.Input to accept any type args ([#89](https://github.com/oclif/command/issues/89)) ([baf3576](https://github.com/oclif/command/commit/baf3576ba23a4901c8d99f094f1267cd4ff30fd7)) 333 | 334 | 335 | 336 | # [1.6.0](https://github.com/oclif/command/compare/v1.5.20...v1.6.0) (2020-05-01) 337 | 338 | 339 | ### Features 340 | 341 | * add loading for alternative help classes ([#85](https://github.com/oclif/command/issues/85)) ([136e7d4](https://github.com/oclif/command/commit/136e7d4f35c7ac1087e6af920dcadf21bc73530f)) 342 | 343 | 344 | 345 | ## [1.5.20](https://github.com/oclif/command/compare/v1.5.19...v1.5.20) (2020-04-20) 346 | 347 | 348 | 349 | ## [1.5.19](https://github.com/oclif/command/compare/v1.5.18...v1.5.19) (2019-09-05) 350 | 351 | 352 | ### Bug Fixes 353 | 354 | * `default` should be `T[]` when `multiple: true` ([#70](https://github.com/oclif/command/issues/70)) ([13da51c](https://github.com/oclif/command/commit/13da51c0506b499388f14a5940e41fc751685289)) 355 | 356 | 357 | 358 | ## [1.5.18](https://github.com/oclif/command/compare/v1.5.17...v1.5.18) (2019-07-22) 359 | 360 | 361 | 362 | ## [1.5.17](https://github.com/oclif/command/compare/v1.5.16...v1.5.17) (2019-07-15) 363 | 364 | 365 | ### Bug Fixes 366 | 367 | * sync types with @oclif/parser ([#67](https://github.com/oclif/command/issues/67)) ([2a5f0b5](https://github.com/oclif/command/commit/2a5f0b56f97663ea5da38caa8b5db9eedbb33a32)) 368 | 369 | 370 | 371 | ## [1.5.16](https://github.com/oclif/command/compare/v1.5.15...v1.5.16) (2019-07-10) 372 | 373 | 374 | 375 | ## [1.5.15](https://github.com/oclif/command/compare/v1.5.14...v1.5.15) (2019-06-20) 376 | 377 | 378 | 379 | ## [1.5.14](https://github.com/oclif/command/compare/v1.5.13...v1.5.14) (2019-05-30) 380 | 381 | 382 | ### Bug Fixes 383 | 384 | * remove stdout error listener as a member instance ([#65](https://github.com/oclif/command/issues/65)) ([5febe63](https://github.com/oclif/command/commit/5febe6330c5b71473df6a7da585abc4108497dcf)) 385 | 386 | 387 | 388 | ## [1.5.13](https://github.com/oclif/command/compare/v1.5.12...v1.5.13) (2019-04-15) 389 | 390 | 391 | ### Bug Fixes 392 | 393 | * use showCommandHelp to delegate topic help ([#58](https://github.com/oclif/command/issues/58)) ([3c0bafd](https://github.com/oclif/command/commit/3c0bafd840b663f34286a9b1cb84aaee368a210d)) 394 | 395 | 396 | 397 | ## [1.5.12](https://github.com/oclif/command/compare/v1.5.11...v1.5.12) (2019-03-15) 398 | 399 | 400 | 401 | ## [1.5.11](https://github.com/oclif/command/compare/v1.5.10...v1.5.11) (2019-02-27) 402 | 403 | 404 | ### Bug Fixes 405 | 406 | * handle epipe errors ([61d3a29](https://github.com/oclif/command/commit/61d3a29dcb821078515edd4dadd72e4399013e13)) 407 | 408 | 409 | 410 | ## [1.5.10](https://github.com/oclif/command/compare/v1.5.9...v1.5.10) (2019-02-11) 411 | 412 | 413 | 414 | ## [1.5.9](https://github.com/oclif/command/compare/v1.5.8...v1.5.9) (2019-02-11) 415 | 416 | 417 | ### Bug Fixes 418 | 419 | * typescript@3.3 ([3800acc](https://github.com/oclif/command/commit/3800acca43337d10f8328b5aa77025d12835a838)) 420 | 421 | 422 | 423 | ## [1.5.8](https://github.com/oclif/command/compare/v1.5.7...v1.5.8) (2018-12-18) 424 | 425 | 426 | 427 | ## [1.5.7](https://github.com/oclif/command/compare/v1.5.6...v1.5.7) (2018-12-18) 428 | 429 | 430 | 431 | ## [1.5.6](https://github.com/oclif/command/compare/v1.5.5...v1.5.6) (2018-11-14) 432 | 433 | 434 | ### Reverts 435 | 436 | * Revert "fix: construct full help message for known Command (#50)" ([46456dd](https://github.com/oclif/command/commit/46456dd962895f67616c16093c49cf91a571c5bc)), closes [#50](https://github.com/oclif/command/issues/50) 437 | 438 | 439 | 440 | ## [1.5.5](https://github.com/oclif/command/compare/v1.5.4...v1.5.5) (2018-11-12) 441 | 442 | 443 | ### Bug Fixes 444 | 445 | * construct full help message for known Command ([#50](https://github.com/oclif/command/issues/50)) ([5ef4e3c](https://github.com/oclif/command/commit/5ef4e3c89d1b74af02217bc40d0e8160e5e7a170)) 446 | 447 | 448 | 449 | ## [1.5.4](https://github.com/oclif/command/compare/v1.5.3...v1.5.4) (2018-10-13) 450 | 451 | 452 | ### Bug Fixes 453 | 454 | * remove greenkeeper badge ([c6a0c6f](https://github.com/oclif/command/commit/c6a0c6f8d50a7354db724b8f0326859037911f08)) 455 | 456 | 457 | 458 | ## [1.5.3](https://github.com/oclif/command/compare/v1.5.2...v1.5.3) (2018-10-13) 459 | 460 | 461 | ### Bug Fixes 462 | 463 | * return promiselike ([#47](https://github.com/oclif/command/issues/47)) ([2eb6b60](https://github.com/oclif/command/commit/2eb6b609f9de4f2909b4107fde92fdc8818b42d6)) 464 | 465 | 466 | 467 | ## [1.5.2](https://github.com/oclif/command/compare/v1.5.1...v1.5.2) (2018-10-03) 468 | 469 | 470 | ### Bug Fixes 471 | 472 | * updated deps ([bb0df38](https://github.com/oclif/command/commit/bb0df384906846392f942e5a15d4ca0b69104c6b)) 473 | 474 | 475 | 476 | ## [1.5.1](https://github.com/oclif/command/compare/v1.5.0...v1.5.1) (2018-09-14) 477 | 478 | 479 | ### Bug Fixes 480 | 481 | * lint issues ([d561bbf](https://github.com/oclif/command/commit/d561bbfd1acf4495036fe0ac6bf914af27c963f7)) 482 | * updated deps ([809f184](https://github.com/oclif/command/commit/809f1840423259c0c08b7b88cacfcb4ccb99dc2d)) 483 | 484 | 485 | 486 | # [1.5.0](https://github.com/oclif/command/compare/v1.4.36...v1.5.0) (2018-08-17) 487 | 488 | 489 | ### Features 490 | 491 | * typescript 3 ([fc6a991](https://github.com/oclif/command/commit/fc6a9916316713c3c017314471e4ad9fe8d07053)) 492 | 493 | 494 | 495 | ## [1.4.36](https://github.com/oclif/command/compare/v1.4.35...v1.4.36) (2018-07-25) 496 | 497 | 498 | ### Bug Fixes 499 | 500 | * Trim description before printing first line since there could be leading `\n` from multi-line template strings. ([#40](https://github.com/oclif/command/issues/40)) ([7be154c](https://github.com/oclif/command/commit/7be154c0540d7a95ee34166fa5373aca0f664fe2)) 501 | 502 | 503 | 504 | ## [1.4.35](https://github.com/oclif/command/compare/v1.4.34...v1.4.35) (2018-07-19) 505 | 506 | 507 | ### Bug Fixes 508 | 509 | * only flush if errorLogger present ([#41](https://github.com/oclif/command/issues/41)) ([f183916](https://github.com/oclif/command/commit/f1839164a404072189083ac73920a9da98f4d046)) 510 | 511 | 512 | 513 | ## [1.4.34](https://github.com/oclif/command/compare/v1.4.33...v1.4.34) (2018-06-26) 514 | 515 | 516 | ### Bug Fixes 517 | 518 | * globals in ts 2.9.2 ([8769c6b](https://github.com/oclif/command/commit/8769c6ba1eee4e045576bcf8ffc256c793d45fad)) 519 | 520 | 521 | 522 | ## [1.4.33](https://github.com/oclif/command/compare/v1.4.32...v1.4.33) (2018-06-09) 523 | 524 | 525 | ### Reverts 526 | 527 | * Revert "[FIX] bump parse version dependency" ([c255811](https://github.com/oclif/command/commit/c2558110d8ddfd1b24a543f1c01b363ce4c8d725)) 528 | 529 | 530 | 531 | ## [1.4.32](https://github.com/oclif/command/compare/v1.4.31...v1.4.32) (2018-06-01) 532 | 533 | 534 | ### Bug Fixes 535 | 536 | * imports ([4bf98c4](https://github.com/oclif/command/commit/4bf98c40793341ebb30da53fa895d99c34372522)) 537 | 538 | 539 | 540 | ## [1.4.31](https://github.com/oclif/command/compare/v1.4.30...v1.4.31) (2018-05-31) 541 | 542 | 543 | ### Bug Fixes 544 | 545 | * typescript 2.9 ([91499c9](https://github.com/oclif/command/commit/91499c93f97b9440975a28fe696cd29829fcc9c1)) 546 | 547 | 548 | 549 | ## [1.4.30](https://github.com/oclif/command/compare/v1.4.29...v1.4.30) (2018-05-15) 550 | 551 | 552 | ### Bug Fixes 553 | 554 | * use node 8 compatible syntax ([085369c](https://github.com/oclif/command/commit/085369c683e8753ba9e9cd34003bf89f8abd4aab)) 555 | 556 | 557 | 558 | ## [1.4.29](https://github.com/oclif/command/compare/v1.4.28...v1.4.29) (2018-05-13) 559 | 560 | 561 | ### Bug Fixes 562 | 563 | * allow subclasses to return any promise type ([aa89f1e](https://github.com/oclif/command/commit/aa89f1ef60b7ee18981c791402b30ae0590154b8)) 564 | 565 | 566 | 567 | ## [1.4.28](https://github.com/oclif/command/compare/v1.4.27...v1.4.28) (2018-05-13) 568 | 569 | 570 | ### Bug Fixes 571 | 572 | * move flush to top-level ([6b7af6a](https://github.com/oclif/command/commit/6b7af6ac9a30f5b539cb18c7280ecd97dfa9e654)) 573 | 574 | 575 | 576 | ## [1.4.27](https://github.com/oclif/command/compare/v1.4.26...v1.4.27) (2018-05-13) 577 | 578 | 579 | ### Bug Fixes 580 | 581 | * linting issue ([a3408cb](https://github.com/oclif/command/commit/a3408cbf50b706630b7054659d969e8474c938ad)) 582 | 583 | 584 | 585 | ## [1.4.26](https://github.com/oclif/command/compare/v1.4.25...v1.4.26) (2018-05-13) 586 | 587 | 588 | ### Bug Fixes 589 | 590 | * require flush to occur manually to fix tests ([82a45eb](https://github.com/oclif/command/commit/82a45ebcae094c74d4486ed53c4a1c1e2ebf00f3)) 591 | 592 | 593 | 594 | ## [1.4.25](https://github.com/oclif/command/compare/v1.4.24...v1.4.25) (2018-05-13) 595 | 596 | 597 | ### Bug Fixes 598 | 599 | * only flush stdout when no error ([ed0f5b7](https://github.com/oclif/command/commit/ed0f5b7c6e883751baadfde9f574fb1853cb9ca0)) 600 | 601 | 602 | 603 | ## [1.4.24](https://github.com/oclif/command/compare/v1.4.23...v1.4.24) (2018-05-13) 604 | 605 | 606 | ### Bug Fixes 607 | 608 | * flush stdout on exit ([8b38347](https://github.com/oclif/command/commit/8b38347400cadaf37a7fc77263aaeec8577220b8)) 609 | 610 | 611 | 612 | ## [1.4.23](https://github.com/oclif/command/compare/v1.4.22...v1.4.23) (2018-05-12) 613 | 614 | 615 | ### Bug Fixes 616 | 617 | * typing for this.error() ([1c7e03c](https://github.com/oclif/command/commit/1c7e03cbce9d9aec6c183c35a6e30b8031afa78e)) 618 | 619 | 620 | 621 | ## [1.4.22](https://github.com/oclif/command/compare/v1.4.21...v1.4.22) (2018-05-12) 622 | 623 | 624 | ### Bug Fixes 625 | 626 | * remove yarn check from CI ([b836340](https://github.com/oclif/command/commit/b83634078bf2ac204e45629785fd08c27906e583)) 627 | * typing for this.error() ([af70aed](https://github.com/oclif/command/commit/af70aed40703a22e65529ebbee8f43fc19954675)) 628 | * typing for this.error() ([3a7ec33](https://github.com/oclif/command/commit/3a7ec3312154bcf379efec9dac47f864fd8de784)) 629 | 630 | 631 | 632 | ## [1.4.21](https://github.com/oclif/command/compare/v1.4.20...v1.4.21) (2018-05-06) 633 | 634 | 635 | ### Bug Fixes 636 | 637 | * return types of error/exit methods ([19ff4de](https://github.com/oclif/command/commit/19ff4debed6fa80b0c6716d779edb7f31326fbc0)) 638 | 639 | 640 | 641 | ## [1.4.20](https://github.com/oclif/command/compare/v1.4.19...v1.4.20) (2018-05-03) 642 | 643 | 644 | ### Bug Fixes 645 | 646 | * updated errors plugin ([39f04d8](https://github.com/oclif/command/commit/39f04d8d97a2667db56223ed7efd393d2b497e22)) 647 | 648 | 649 | 650 | ## [1.4.19](https://github.com/oclif/command/compare/v1.4.18...v1.4.19) (2018-05-02) 651 | 652 | 653 | ### Bug Fixes 654 | 655 | * allow subsessions to run redirected CLI ([42c4bc3](https://github.com/oclif/command/commit/42c4bc3292e43f3683a1cd5791d9a05853e2a877)) 656 | 657 | 658 | 659 | ## [1.4.18](https://github.com/oclif/command/compare/v1.4.17...v1.4.18) (2018-05-01) 660 | 661 | 662 | ### Bug Fixes 663 | 664 | * export integer flag ([11a14b1](https://github.com/oclif/command/commit/11a14b1f6ec970e24e8ad6c060e816f7c68aad7a)) 665 | 666 | 667 | 668 | ## [1.4.17](https://github.com/oclif/command/compare/v1.4.16...v1.4.17) (2018-04-30) 669 | 670 | 671 | ### Bug Fixes 672 | 673 | * allow --version as first argument to command ([2a27613](https://github.com/oclif/command/commit/2a2761359fe79cfb0d52bc7a4e743785b46f4e99)) 674 | 675 | 676 | 677 | ## [1.4.16](https://github.com/oclif/command/compare/v1.4.15...v1.4.16) (2018-04-25) 678 | 679 | 680 | ### Bug Fixes 681 | 682 | * allow specifying --version flag on commands ([4db8ccd](https://github.com/oclif/command/commit/4db8ccdd1745a9caa461bc45ab336a8c250d1ed9)) 683 | 684 | 685 | 686 | ## [1.4.15](https://github.com/oclif/command/compare/v1.4.14...v1.4.15) (2018-04-22) 687 | 688 | 689 | ### Bug Fixes 690 | 691 | * add check for cwd ([afa6e01](https://github.com/oclif/command/commit/afa6e019c14d4c7d00277e84aa44c539ae775cc8)) 692 | * updated deps ([afa28ee](https://github.com/oclif/command/commit/afa28ee22b39cbcfc1e5ab26f20aed3c64b26619)) 693 | 694 | 695 | 696 | ## [1.4.14](https://github.com/oclif/command/compare/v1.4.13...v1.4.14) (2018-04-21) 697 | 698 | 699 | ### Bug Fixes 700 | 701 | * stop cli-ux action on error ([cd7e1e1](https://github.com/oclif/command/commit/cd7e1e1eec6a3225f13b4a8d49a30394226f6fd8)) 702 | 703 | 704 | 705 | ## [1.4.13](https://github.com/oclif/command/compare/v1.4.12...v1.4.13) (2018-04-09) 706 | 707 | 708 | ### Bug Fixes 709 | 710 | * updated parser ([45e2108](https://github.com/oclif/command/commit/45e210848e938b2fe3032619ab821c4cb8f7c460)) 711 | 712 | 713 | 714 | ## [1.4.12](https://github.com/oclif/command/compare/v1.4.11...v1.4.12) (2018-04-09) 715 | 716 | 717 | ### Bug Fixes 718 | 719 | * updated parser ([67a4509](https://github.com/oclif/command/commit/67a45096abd1391c84ca26df7ee48915e371f681)) 720 | 721 | 722 | 723 | ## [1.4.11](https://github.com/oclif/command/compare/v1.4.10...v1.4.11) (2018-04-09) 724 | 725 | 726 | ### Bug Fixes 727 | 728 | * updated parser ([c9212de](https://github.com/oclif/command/commit/c9212de43ef730e52e88ac8757cc4f7297b6af94)) 729 | 730 | 731 | 732 | ## [1.4.10](https://github.com/oclif/command/compare/v1.4.9...v1.4.10) (2018-04-09) 733 | 734 | 735 | ### Bug Fixes 736 | 737 | * updated parser ([1eb0216](https://github.com/oclif/command/commit/1eb02169f04e9bcb89c866e89faad6112ad6302c)) 738 | 739 | 740 | 741 | ## [1.4.9](https://github.com/oclif/command/compare/v1.4.8...v1.4.9) (2018-04-08) 742 | 743 | 744 | ### Bug Fixes 745 | 746 | * https://github.com/oclif/oclif/issues/95 ([a8d4d93](https://github.com/oclif/command/commit/a8d4d9328406937a17556d4725fcbc049b5bfda1)) 747 | * updated deps and fixed linter ([bda888a](https://github.com/oclif/command/commit/bda888aa5a4a6dcaeba315fcb28c1b6a5c45f06a)) 748 | 749 | 750 | 751 | ## [1.4.8](https://github.com/oclif/command/compare/v1.4.7...v1.4.8) (2018-04-08) 752 | 753 | 754 | ### Bug Fixes 755 | 756 | * throw error if no message ([c1ed043](https://github.com/oclif/command/commit/c1ed043efc89142169b089091e118899281421e0)) 757 | 758 | 759 | 760 | ## [1.4.7](https://github.com/oclif/command/compare/v1.4.6...v1.4.7) (2018-04-06) 761 | 762 | 763 | ### Bug Fixes 764 | 765 | * make this.log() behave more like console.log() ([7d145e1](https://github.com/oclif/command/commit/7d145e1fff534acd4349eb78d3ef65208d8b1345)) 766 | 767 | 768 | 769 | ## [1.4.6](https://github.com/oclif/command/compare/v1.4.5...v1.4.6) (2018-03-25) 770 | 771 | 772 | ### Bug Fixes 773 | 774 | * run init before all multi commands ([47be866](https://github.com/oclif/command/commit/47be866b6cce4444002618e3c2ee8aeb8865e243)) 775 | 776 | 777 | 778 | ## [1.4.5](https://github.com/oclif/command/compare/v1.4.4...v1.4.5) (2018-03-24) 779 | 780 | 781 | ### Bug Fixes 782 | 783 | * use new semantic-release ([336d6a3](https://github.com/oclif/command/commit/336d6a3b74bbbcefd9f67d7744dc5f1ea4b94b4f)) 784 | 785 | 786 | 787 | ## [1.4.4](https://github.com/oclif/command/compare/v1.4.3...v1.4.4) (2018-03-24) 788 | 789 | 790 | ### Bug Fixes 791 | 792 | * add debug dependency ([300bbb7](https://github.com/oclif/command/commit/300bbb7c053fb6bb9fac5f3beac56df45aebecb3)) 793 | 794 | 795 | 796 | ## [1.4.3](https://github.com/oclif/command/compare/v1.4.2...v1.4.3) (2018-03-24) 797 | 798 | 799 | ### Bug Fixes 800 | 801 | * add @oclif/errors to dependencies ([b2d0790](https://github.com/oclif/command/commit/b2d0790b00cab77c53abdfa35970f99753713116)) 802 | 803 | 804 | 805 | ## [1.4.2](https://github.com/oclif/command/compare/v1.4.1...v1.4.2) (2018-02-28) 806 | 807 | 808 | ### Bug Fixes 809 | 810 | * add return type ([8808788](https://github.com/oclif/command/commit/8808788e3f6c494606d1e2662382eeede0e0a254)) 811 | 812 | 813 | 814 | ## [1.4.1](https://github.com/oclif/command/compare/v1.4.0...v1.4.1) (2018-02-28) 815 | 816 | 817 | ### Bug Fixes 818 | 819 | * fixed return value ([15212c3](https://github.com/oclif/command/commit/15212c3025cdc62433ec305a919b65487a53d8b0)) 820 | 821 | 822 | 823 | # [1.4.0](https://github.com/oclif/command/compare/v1.3.3...v1.4.0) (2018-02-28) 824 | 825 | 826 | ### Features 827 | 828 | * return value from command ([0651ef0](https://github.com/oclif/command/commit/0651ef054e01f9eb6e54cfff598d8b126f8aefe5)) 829 | 830 | 831 | 832 | ## [1.3.3](https://github.com/oclif/command/compare/v1.3.2...v1.3.3) (2018-02-17) 833 | 834 | 835 | ### Bug Fixes 836 | 837 | * fixed help command ([785f4f4](https://github.com/oclif/command/commit/785f4f485397ee5485e391c3ac4342959c140dcc)) 838 | 839 | 840 | 841 | ## [1.3.2](https://github.com/oclif/command/compare/v1.3.1...v1.3.2) (2018-02-17) 842 | 843 | 844 | ### Bug Fixes 845 | 846 | * show topic if command not found but topic exists ([efd58a6](https://github.com/oclif/command/commit/efd58a604e350a0e24773dad2a6779842211d7ce)) 847 | 848 | 849 | 850 | ## [1.3.1](https://github.com/oclif/command/compare/v1.3.0...v1.3.1) (2018-02-17) 851 | 852 | 853 | ### Bug Fixes 854 | 855 | * fixed single command help ([efe7409](https://github.com/oclif/command/commit/efe740935047280860dd12a0a1a5781ceeac3fc7)) 856 | * updated help ([48235ab](https://github.com/oclif/command/commit/48235ab91b184b761232905d3b6c49ceeedc6441)) 857 | 858 | 859 | 860 | # [1.3.0](https://github.com/oclif/command/compare/v1.2.25...v1.3.0) (2018-02-15) 861 | 862 | 863 | ### Features 864 | 865 | * added node version check ([d672877](https://github.com/oclif/command/commit/d67287709694b6e16a940e445378e419e0312f66)) 866 | 867 | 868 | 869 | ## [1.2.25](https://github.com/oclif/command/compare/v1.2.24...v1.2.25) (2018-02-14) 870 | 871 | 872 | 873 | ## [1.2.24](https://github.com/oclif/command/compare/v1.2.23...v1.2.24) (2018-02-14) 874 | 875 | 876 | ### Bug Fixes 877 | 878 | * updated deps ([b643478](https://github.com/oclif/command/commit/b643478dd35896a22dbf447a30dd0d495df293eb)) 879 | * updated parser ([69e7509](https://github.com/oclif/command/commit/69e75098a816aac75be6c8fbabee275516523471)) 880 | 881 | 882 | 883 | ## [1.2.23](https://github.com/oclif/command/compare/v1.2.22...v1.2.23) (2018-02-13) 884 | 885 | 886 | ### Bug Fixes 887 | 888 | * updated deps ([633de2e](https://github.com/oclif/command/commit/633de2e141f2338184a95ecc6c1a95e592f37c09)) 889 | 890 | 891 | 892 | ## [1.2.22](https://github.com/oclif/command/compare/v1.2.21...v1.2.22) (2018-02-13) 893 | 894 | 895 | ### Bug Fixes 896 | 897 | * updated plugin-plugins ([0d3f94a](https://github.com/oclif/command/commit/0d3f94a8d41a5903c34a5cfd3625bb42b4d4062c)) 898 | 899 | 900 | 901 | ## [1.2.21](https://github.com/oclif/command/compare/v1.2.20...v1.2.21) (2018-02-13) 902 | 903 | 904 | ### Bug Fixes 905 | 906 | * oclif rename ([45b34a8](https://github.com/oclif/command/commit/45b34a88a796a79d3c0d20124a7a9919b12edec8)) 907 | * oclif rename ([bc6169b](https://github.com/oclif/command/commit/bc6169b09e1254a4049a067d60fb97b897d204ad)) 908 | 909 | 910 | 911 | ## [1.2.20](https://github.com/oclif/command/compare/v1.2.19...v1.2.20) (2018-02-13) 912 | 913 | 914 | ### Bug Fixes 915 | 916 | * rename to oclif ([c416eb5](https://github.com/oclif/command/commit/c416eb55471a36183132f8f593a13bd877916b64)) 917 | * rename to oclif ([b9ee8e6](https://github.com/oclif/command/commit/b9ee8e62562a4a051b2329c700e1aa24c03d2af4)) 918 | * rename to oclif ([20d4584](https://github.com/oclif/command/commit/20d4584fa78d316ac18714c72c6b18d3cb1e1437)) 919 | 920 | 921 | 922 | ## [1.2.19](https://github.com/oclif/command/compare/v1.2.18...v1.2.19) (2018-02-07) 923 | 924 | 925 | ### Bug Fixes 926 | 927 | * fixed error flushing ([de02208](https://github.com/oclif/command/commit/de022085f00edb3421545399f49f055efa651fe7)) 928 | 929 | 930 | 931 | ## [1.2.18](https://github.com/oclif/command/compare/v1.2.17...v1.2.18) (2018-02-07) 932 | 933 | 934 | ### Bug Fixes 935 | 936 | * async ([2040de0](https://github.com/oclif/command/commit/2040de0747060f289ec4092e2a619a7bb4d115ab)) 937 | 938 | 939 | 940 | ## [1.2.17](https://github.com/oclif/command/compare/v1.2.16...v1.2.17) (2018-02-07) 941 | 942 | 943 | ### Bug Fixes 944 | 945 | * updated config ([a9f7952](https://github.com/oclif/command/commit/a9f79525c45e18d2d0a761a502bd19174d1af748)) 946 | 947 | 948 | 949 | ## [1.2.16](https://github.com/oclif/command/compare/v1.2.15...v1.2.16) (2018-02-07) 950 | 951 | 952 | ### Bug Fixes 953 | 954 | * async ([d79cd60](https://github.com/oclif/command/commit/d79cd606fdbe62b2d80b9f91f627783b42d59747)) 955 | * async ([3831268](https://github.com/oclif/command/commit/38312680f43bfa4244467ca1f4f0542096902f55)) 956 | 957 | 958 | 959 | ## [1.2.15](https://github.com/oclif/command/compare/v1.2.14...v1.2.15) (2018-02-07) 960 | 961 | 962 | ### Performance Improvements 963 | 964 | * flush errors not cli-ux ([daed294](https://github.com/oclif/command/commit/daed294d10995de317517ea0d3e3d66a65971411)) 965 | 966 | 967 | 968 | ## [1.2.14](https://github.com/oclif/command/compare/v1.2.12...v1.2.14) (2018-02-07) 969 | 970 | 971 | ### Bug Fixes 972 | 973 | * updated config ([19b1b4f](https://github.com/oclif/command/commit/19b1b4f33f26be64ab90fe2fcbec7ed72ba71e7a)) 974 | * use LoadOptions ([b880aa3](https://github.com/oclif/command/commit/b880aa378b7e38b7f933f38c465c87567995eb1c)) 975 | 976 | 977 | 978 | ## [1.2.12](https://github.com/oclif/command/compare/v1.2.11...v1.2.12) (2018-02-06) 979 | 980 | 981 | ### Bug Fixes 982 | 983 | * allow these types ([b4fd493](https://github.com/oclif/command/commit/b4fd49343d23e4b9b469e8ee04bd33a30795bc9b)) 984 | 985 | 986 | 987 | ## [1.2.11](https://github.com/oclif/command/compare/v1.2.10...v1.2.11) (2018-02-06) 988 | 989 | 990 | ### Bug Fixes 991 | 992 | * updated config ([68b277c](https://github.com/oclif/command/commit/68b277c4502b5abf918501813ff939dce5bcbd3a)) 993 | 994 | 995 | 996 | ## [1.2.10](https://github.com/oclif/command/compare/v1.2.9...v1.2.10) (2018-02-06) 997 | 998 | 999 | ### Bug Fixes 1000 | 1001 | * updated parser ([3afcea3](https://github.com/oclif/command/commit/3afcea361a4af5b78743962e3793c4cfd6ceaa0f)) 1002 | 1003 | 1004 | 1005 | ## [1.2.9](https://github.com/oclif/command/compare/v1.2.8...v1.2.9) (2018-02-06) 1006 | 1007 | 1008 | ### Bug Fixes 1009 | 1010 | * use @anycli/errors ([b9424dc](https://github.com/oclif/command/commit/b9424dcd68c774605f5956962571fda2c6e86eef)) 1011 | 1012 | 1013 | 1014 | ## [1.2.8](https://github.com/oclif/command/compare/v1.2.7...v1.2.8) (2018-02-05) 1015 | 1016 | 1017 | ### Bug Fixes 1018 | 1019 | * add error handler ([ce49022](https://github.com/oclif/command/commit/ce490223d1d5a23619712330b1919965d3d2e143)) 1020 | 1021 | 1022 | 1023 | ## [1.2.7](https://github.com/oclif/command/compare/v1.2.6...v1.2.7) (2018-02-05) 1024 | 1025 | 1026 | ### Bug Fixes 1027 | 1028 | * updated plugins plugin ([dd18e9c](https://github.com/oclif/command/commit/dd18e9c08ece41f3cbb04b21080a52ffa102cadf)) 1029 | 1030 | 1031 | 1032 | ## [1.2.6](https://github.com/oclif/command/compare/v1.2.5...v1.2.6) (2018-02-05) 1033 | 1034 | 1035 | ### Bug Fixes 1036 | 1037 | * move ExitError to config ([84a397e](https://github.com/oclif/command/commit/84a397ed21572b4276bfebed3f7adc9824243690)) 1038 | 1039 | 1040 | 1041 | ## [1.2.5](https://github.com/oclif/command/compare/v1.2.4...v1.2.5) (2018-02-05) 1042 | 1043 | 1044 | ### Bug Fixes 1045 | 1046 | * reduce dependencies ([7b0acc6](https://github.com/oclif/command/commit/7b0acc6f82620daebabbdc57838df055239b4edf)) 1047 | 1048 | 1049 | 1050 | ## [1.2.4](https://github.com/oclif/command/compare/v1.2.3...v1.2.4) (2018-02-03) 1051 | 1052 | 1053 | ### Bug Fixes 1054 | 1055 | * fixed init hook arguments ([26895f7](https://github.com/oclif/command/commit/26895f76a879a002cf01319aba3779ba4cad8ae9)) 1056 | * help improvements ([93b8f8d](https://github.com/oclif/command/commit/93b8f8d05660c51dbee2c4cd077f752a5157e692)) 1057 | 1058 | 1059 | 1060 | ## [1.2.3](https://github.com/oclif/command/compare/v1.2.2...v1.2.3) (2018-02-03) 1061 | 1062 | 1063 | ### Bug Fixes 1064 | 1065 | * bump parser ([a002c7c](https://github.com/oclif/command/commit/a002c7c2e3f54a0a0bd37b4844ceea5d815d69f6)) 1066 | 1067 | 1068 | 1069 | ## [1.2.2](https://github.com/oclif/command/compare/v1.2.1...v1.2.2) (2018-02-03) 1070 | 1071 | 1072 | ### Bug Fixes 1073 | 1074 | * updated config ([13a6193](https://github.com/oclif/command/commit/13a6193a1e2c577b3eaa49c6f38d2326eb40eea9)) 1075 | 1076 | 1077 | 1078 | ## [1.2.1](https://github.com/oclif/command/compare/v1.2.0...v1.2.1) (2018-02-03) 1079 | 1080 | 1081 | ### Bug Fixes 1082 | 1083 | * updated config ([26e8568](https://github.com/oclif/command/commit/26e8568b8f8f778d5a74773decc92446b09d4618)) 1084 | 1085 | 1086 | 1087 | # [1.2.0](https://github.com/oclif/command/compare/v1.1.2...v1.2.0) (2018-02-03) 1088 | 1089 | 1090 | ### Features 1091 | 1092 | * added _run and parse functions ([8e90f26](https://github.com/oclif/command/commit/8e90f265aebd64778590a35e959ab20d053148e4)) 1093 | 1094 | 1095 | 1096 | ## [1.1.2](https://github.com/oclif/command/compare/v1.1.1...v1.1.2) (2018-02-03) 1097 | 1098 | 1099 | ### Bug Fixes 1100 | 1101 | * add run function ([bbfc5f7](https://github.com/oclif/command/commit/bbfc5f72c5e304c8a32a21cd2fd3295c8c19a9eb)) 1102 | 1103 | 1104 | 1105 | ## [1.1.1](https://github.com/oclif/command/compare/v1.1.0...v1.1.1) (2018-02-03) 1106 | 1107 | 1108 | ### Bug Fixes 1109 | 1110 | * export main ([6815883](https://github.com/oclif/command/commit/68158831718f70da1cc0b282e35b108791ee6c3a)) 1111 | * fixed parent module path ([6d090ae](https://github.com/oclif/command/commit/6d090aefd78fd13a556e625f8e28b445476912ee)) 1112 | 1113 | 1114 | 1115 | # [1.1.0](https://github.com/oclif/command/compare/v1.0.1...v1.1.0) (2018-02-03) 1116 | 1117 | 1118 | ### Features 1119 | 1120 | * added main command for multi CLI projects ([a215636](https://github.com/oclif/command/commit/a21563609a404cd274942b55e1cf41ac0724a014)) 1121 | 1122 | 1123 | 1124 | ## [1.0.1](https://github.com/oclif/command/compare/v1.0.0...v1.0.1) (2018-02-03) 1125 | 1126 | 1127 | ### Bug Fixes 1128 | 1129 | * fixed parent module path ([209d4ff](https://github.com/oclif/command/commit/209d4fff5eeca27768ef5fba96512408d2817cc4)) 1130 | 1131 | 1132 | 1133 | # [1.0.0](https://github.com/oclif/command/compare/v0.3.11...v1.0.0) (2018-02-03) 1134 | 1135 | 1136 | ### Features 1137 | 1138 | * simplify command with new config ([1599c40](https://github.com/oclif/command/commit/1599c40ed9f935cff4ae4c3b3cce8ff9f7b3969e)) 1139 | 1140 | 1141 | ### BREAKING CHANGES 1142 | 1143 | * This is preparation for using the new config object that will not 1144 | require the engine. It is likely incompatible with any anycli version 1145 | before it 1146 | 1147 | 1148 | 1149 | ## [0.3.11](https://github.com/oclif/command/compare/v0.3.10...v0.3.11) (2018-02-02) 1150 | 1151 | 1152 | ### Bug Fixes 1153 | 1154 | * use cli.error on errors ([f3a45a2](https://github.com/oclif/command/commit/f3a45a20a89a517d022c90990e96039995dd52b5)) 1155 | 1156 | 1157 | 1158 | ## [0.3.10](https://github.com/oclif/command/compare/v0.3.9...v0.3.10) (2018-02-02) 1159 | 1160 | 1161 | ### Bug Fixes 1162 | 1163 | * allow engine to grab --help ([f8689ea](https://github.com/oclif/command/commit/f8689ea71d2375926ae4504e755c70af0e47d21a)) 1164 | * fixed --help on test command ([57659f6](https://github.com/oclif/command/commit/57659f6122fefe19ba41804633ac7edea5f007a2)) 1165 | 1166 | 1167 | 1168 | ## [0.3.9](https://github.com/oclif/command/compare/v0.3.8...v0.3.9) (2018-02-02) 1169 | 1170 | 1171 | ### Bug Fixes 1172 | 1173 | * dispatch help to plugin-help ([c57e7ac](https://github.com/oclif/command/commit/c57e7aca63274505d09c801f7fa32fcf51142362)) 1174 | 1175 | 1176 | 1177 | ## [0.3.8](https://github.com/oclif/command/compare/v0.3.7...v0.3.8) (2018-02-02) 1178 | 1179 | 1180 | ### Bug Fixes 1181 | 1182 | * add type to command ([dcea31b](https://github.com/oclif/command/commit/dcea31b2ba2bfcb2fb2851750ff2a77f12d1419f)) 1183 | 1184 | 1185 | 1186 | ## [0.3.7](https://github.com/oclif/command/compare/v0.3.6...v0.3.7) (2018-02-02) 1187 | 1188 | 1189 | ### Bug Fixes 1190 | 1191 | * config updates ([a311900](https://github.com/oclif/command/commit/a31190002da11a8b59883923f687091afb086060)) 1192 | 1193 | 1194 | 1195 | ## [0.3.6](https://github.com/oclif/command/compare/v0.3.5...v0.3.6) (2018-02-02) 1196 | 1197 | 1198 | ### Bug Fixes 1199 | 1200 | * use new plugin names ([a8a9b25](https://github.com/oclif/command/commit/a8a9b25444e57bd3e3bdbd18656416f76431d9f5)) 1201 | 1202 | 1203 | 1204 | ## [0.3.5](https://github.com/oclif/command/compare/v0.3.4...v0.3.5) (2018-02-02) 1205 | 1206 | 1207 | ### Bug Fixes 1208 | 1209 | * ran generator ([bebe38a](https://github.com/oclif/command/commit/bebe38ae0a294662996e8cef5be29112929db941)) 1210 | 1211 | 1212 | 1213 | ## [0.3.4](https://github.com/oclif/command/compare/v0.3.3...v0.3.4) (2018-02-02) 1214 | 1215 | 1216 | ### Bug Fixes 1217 | 1218 | * fixed default parameters ([e1fa539](https://github.com/oclif/command/commit/e1fa5399d0b2b90fc0580e4af82ded1212be4cff)) 1219 | 1220 | 1221 | 1222 | ## [0.3.3](https://github.com/oclif/command/compare/v0.3.2...v0.3.3) (2018-02-01) 1223 | 1224 | 1225 | ### Bug Fixes 1226 | 1227 | * pass empty object to default ([2186ab5](https://github.com/oclif/command/commit/2186ab5a8731fc3a7bc521135dbda71c6d6bddb9)) 1228 | 1229 | 1230 | 1231 | ## [0.3.2](https://github.com/oclif/command/compare/v0.3.1...v0.3.2) (2018-02-01) 1232 | 1233 | 1234 | ### Bug Fixes 1235 | 1236 | * show help for -h ([d4d4bb1](https://github.com/oclif/command/commit/d4d4bb12614a4057436667ca77c8cec2a1636cb0)) 1237 | 1238 | 1239 | 1240 | ## [0.3.1](https://github.com/oclif/command/compare/v0.3.0...v0.3.1) (2018-02-01) 1241 | 1242 | 1243 | ### Bug Fixes 1244 | 1245 | * fixed --help ([d51b5cf](https://github.com/oclif/command/commit/d51b5cff69fe56bd366a2a154f08154261d4b581)) 1246 | 1247 | 1248 | 1249 | # [0.3.0](https://github.com/oclif/command/compare/v0.2.25...v0.3.0) (2018-02-01) 1250 | 1251 | 1252 | ### Features 1253 | 1254 | * added version and help flags ([087b248](https://github.com/oclif/command/commit/087b248216686f4ac50c68782cda61312da26724)) 1255 | 1256 | 1257 | 1258 | ## [0.2.25](https://github.com/oclif/command/compare/v0.2.24...v0.2.25) (2018-02-01) 1259 | 1260 | 1261 | ### Bug Fixes 1262 | 1263 | * added version and help flags ([ab963a2](https://github.com/oclif/command/commit/ab963a2f557902f2936f4f9c71bdb462ca661c4a)) 1264 | 1265 | 1266 | 1267 | ## [0.2.24](https://github.com/oclif/command/compare/v0.2.23...v0.2.24) (2018-02-01) 1268 | 1269 | 1270 | ### Bug Fixes 1271 | 1272 | * add help values to cache ([2484d1e](https://github.com/oclif/command/commit/2484d1ecae3b8bb1ef4aa2ae24995187edf46914)) 1273 | 1274 | 1275 | 1276 | ## [0.2.23](https://github.com/oclif/command/compare/v0.2.22...v0.2.23) (2018-02-01) 1277 | 1278 | 1279 | ### Bug Fixes 1280 | 1281 | * strict by default ([46c5dda](https://github.com/oclif/command/commit/46c5dda5c4895381b561c222000feb4e3484f33a)) 1282 | 1283 | 1284 | 1285 | ## [0.2.22](https://github.com/oclif/command/compare/v0.2.21...v0.2.22) (2018-02-01) 1286 | 1287 | 1288 | ### Bug Fixes 1289 | 1290 | * fixed enum flag ([327e4ed](https://github.com/oclif/command/commit/327e4eddf0962331ee9bf76c2eccad9c8e64804c)) 1291 | * set helpValue ([43478c8](https://github.com/oclif/command/commit/43478c808804359269d3afcc6d7a07fb128c9272)) 1292 | 1293 | 1294 | 1295 | ## [0.2.21](https://github.com/oclif/command/compare/v0.2.20...v0.2.21) (2018-02-01) 1296 | 1297 | 1298 | ### Bug Fixes 1299 | 1300 | * move config to dev ([8670ce0](https://github.com/oclif/command/commit/8670ce0d3c8c131a4d5afadda43bbab03aee8e6e)) 1301 | 1302 | 1303 | 1304 | ## [0.2.20](https://github.com/oclif/command/compare/v0.2.19...v0.2.20) (2018-02-01) 1305 | 1306 | 1307 | ### Bug Fixes 1308 | 1309 | * use type aliases ([547cbdd](https://github.com/oclif/command/commit/547cbdd8ba4bd710218b190b3af8987f937e02b1)) 1310 | 1311 | 1312 | 1313 | ## [0.2.19](https://github.com/oclif/command/compare/v0.2.18...v0.2.19) (2018-01-31) 1314 | 1315 | 1316 | ### Bug Fixes 1317 | 1318 | * move peer deps into required ([3cc1798](https://github.com/oclif/command/commit/3cc179867d389b090f568258b784a055501a4851)) 1319 | 1320 | 1321 | 1322 | ## [0.2.18](https://github.com/oclif/command/compare/v0.2.17...v0.2.18) (2018-01-31) 1323 | 1324 | 1325 | ### Bug Fixes 1326 | 1327 | * updated parser ([e828b46](https://github.com/oclif/command/commit/e828b46723c8aaa2bbc0a860d5646437cb6aeb56)) 1328 | 1329 | 1330 | 1331 | ## [0.2.17](https://github.com/oclif/command/compare/v0.2.16...v0.2.17) (2018-01-31) 1332 | 1333 | 1334 | ### Bug Fixes 1335 | 1336 | * updated config with new command opts ([a186b5f](https://github.com/oclif/command/commit/a186b5f4dd55fb9767ddb2d9a5678af4a9221de0)) 1337 | 1338 | 1339 | 1340 | ## [0.2.16](https://github.com/oclif/command/compare/v0.2.15...v0.2.16) (2018-01-31) 1341 | 1342 | 1343 | ### Bug Fixes 1344 | 1345 | * add init function ([029a620](https://github.com/oclif/command/commit/029a620c04d2ae4fe763d55bb3632755541fbf0e)) 1346 | 1347 | 1348 | 1349 | ## [0.2.15](https://github.com/oclif/command/compare/v0.2.14...v0.2.15) (2018-01-31) 1350 | 1351 | 1352 | ### Bug Fixes 1353 | 1354 | * export parse function ([20bf6ff](https://github.com/oclif/command/commit/20bf6ffc4e4c2002534427aafd483dcafb52db0f)) 1355 | 1356 | 1357 | 1358 | ## [0.2.14](https://github.com/oclif/command/compare/v0.2.13...v0.2.14) (2018-01-31) 1359 | 1360 | 1361 | ### Bug Fixes 1362 | 1363 | * variableArgs ([324e5d9](https://github.com/oclif/command/commit/324e5d9150558b444e38c74430ec1154182a3642)) 1364 | 1365 | 1366 | 1367 | ## [0.2.13](https://github.com/oclif/command/compare/v0.2.12...v0.2.13) (2018-01-31) 1368 | 1369 | 1370 | ### Bug Fixes 1371 | 1372 | * allow passing this into parser ([f8fd99b](https://github.com/oclif/command/commit/f8fd99b360583423d3c6123d69bdd08279635f0a)) 1373 | 1374 | 1375 | 1376 | ## [0.2.12](https://github.com/oclif/command/compare/v0.2.11...v0.2.12) (2018-01-31) 1377 | 1378 | 1379 | ### Bug Fixes 1380 | 1381 | * fixed command options ([fd71035](https://github.com/oclif/command/commit/fd7103504d590f9eaa39728a22d100ed4c95e587)) 1382 | 1383 | 1384 | 1385 | ## [0.2.11](https://github.com/oclif/command/compare/v0.2.10...v0.2.11) (2018-01-31) 1386 | 1387 | 1388 | ### Bug Fixes 1389 | 1390 | * dont slice arg ([1db83e9](https://github.com/oclif/command/commit/1db83e93450be1e08e9cda672e41fd3466c69836)) 1391 | 1392 | 1393 | 1394 | ## [0.2.10](https://github.com/oclif/command/compare/v0.2.9...v0.2.10) (2018-01-31) 1395 | 1396 | 1397 | ### Bug Fixes 1398 | 1399 | * add constructor to make more ts 2.7 compatible ([89dd64c](https://github.com/oclif/command/commit/89dd64c8cf2d5a725199faaaab0720b0da85c307)) 1400 | * added enum flag ([26265e3](https://github.com/oclif/command/commit/26265e37219b65c4d42f3261294b326960160091)) 1401 | * allow passing iconfig ([0b2bb37](https://github.com/oclif/command/commit/0b2bb37a619bfa519e82308cf5b5d57c58035319)) 1402 | * allow setting flag to skip parsing ([743ac50](https://github.com/oclif/command/commit/743ac5049d539cf867b5456cc03d28442ca8b538)) 1403 | * argv fixed ([afddb87](https://github.com/oclif/command/commit/afddb877293fee0a7535e827a82abdc73b7803a4)) 1404 | * remove typedoc for now ([d674fcf](https://github.com/oclif/command/commit/d674fcfab555c54203d79a8e1802e6b60ef691b2)) 1405 | 1406 | 1407 | 1408 | ## [0.2.9](https://github.com/oclif/command/compare/v0.2.8...v0.2.9) (2018-01-31) 1409 | 1410 | 1411 | ### Bug Fixes 1412 | 1413 | * anycli rename ([f6d0558](https://github.com/oclif/command/commit/f6d0558bb92ac09a29061a18cb1ac846f81c57f9)) 1414 | 1415 | 1416 | 1417 | ## [0.2.8](https://github.com/oclif/command/compare/v0.2.7...v0.2.8) (2018-01-30) 1418 | 1419 | 1420 | ### Bug Fixes 1421 | 1422 | * remove hook from this library ([a58e668](https://github.com/oclif/command/commit/a58e668619aca4a31cf240eb46134fe7ef778004)) 1423 | 1424 | 1425 | 1426 | ## [0.2.7](https://github.com/oclif/command/compare/v0.2.6...v0.2.7) (2018-01-30) 1427 | 1428 | 1429 | ### Bug Fixes 1430 | 1431 | * add title to cache ([58bb7ab](https://github.com/oclif/command/commit/58bb7ab4e077f856d8b7efd695a482ddf4c9d056)) 1432 | 1433 | 1434 | 1435 | ## [0.2.6](https://github.com/oclif/command/compare/v0.2.5...v0.2.6) (2018-01-30) 1436 | 1437 | 1438 | ### Bug Fixes 1439 | 1440 | * add new config help vars ([f075793](https://github.com/oclif/command/commit/f075793a01c259f380b0254d4d00615f4e08342b)) 1441 | 1442 | 1443 | 1444 | ## [0.2.5](https://github.com/oclif/command/compare/v0.2.4...v0.2.5) (2018-01-29) 1445 | 1446 | 1447 | ### Bug Fixes 1448 | 1449 | * added help properties ([16908c9](https://github.com/oclif/command/commit/16908c946e8c736ccffe0dd11d4064e427fbe4bc)) 1450 | 1451 | 1452 | 1453 | ## [0.2.4](https://github.com/oclif/command/compare/v0.2.3...v0.2.4) (2018-01-28) 1454 | 1455 | 1456 | ### Bug Fixes 1457 | 1458 | * add options to convertToCached ([e47a6be](https://github.com/oclif/command/commit/e47a6be653ee59c25cb038f1bbe3774b3918d0fd)) 1459 | 1460 | 1461 | 1462 | ## [0.2.3](https://github.com/oclif/command/compare/v0.2.2...v0.2.3) (2018-01-28) 1463 | 1464 | 1465 | ### Bug Fixes 1466 | 1467 | * trap hook error ([a0f770c](https://github.com/oclif/command/commit/a0f770ce3863a449bdbfac98201f48c404c5968d)) 1468 | 1469 | 1470 | 1471 | ## [0.2.2](https://github.com/oclif/command/compare/v0.2.1...v0.2.2) (2018-01-28) 1472 | 1473 | 1474 | ### Bug Fixes 1475 | 1476 | * limit plugin types required ([77fae3a](https://github.com/oclif/command/commit/77fae3aa9b41282d7ea803ee7004e5831d9cce49)) 1477 | 1478 | 1479 | 1480 | ## [0.2.1](https://github.com/oclif/command/compare/v0.2.0...v0.2.1) (2018-01-28) 1481 | 1482 | 1483 | ### Bug Fixes 1484 | 1485 | * expose initDebug() ([e747712](https://github.com/oclif/command/commit/e747712c9c5ff0dd4ac160840b965d79c22270e2)) 1486 | 1487 | 1488 | 1489 | # [0.2.0](https://github.com/oclif/command/compare/v0.1.23...v0.2.0) (2018-01-28) 1490 | 1491 | 1492 | ### Features 1493 | 1494 | * add error context ([6ab4397](https://github.com/oclif/command/commit/6ab4397a4dae0c266e1f562fc7b22f52ad4260e5)) 1495 | 1496 | 1497 | 1498 | ## [0.1.23](https://github.com/oclif/command/compare/v0.1.22...v0.1.23) (2018-01-28) 1499 | 1500 | 1501 | ### Bug Fixes 1502 | 1503 | * move @dxcli/parser into dependencies ([d70edaf](https://github.com/oclif/command/commit/d70edafbc75e0c03d313acc559c2b6c214e9752c)) 1504 | 1505 | 1506 | 1507 | ## [0.1.22](https://github.com/oclif/command/compare/v0.1.21...v0.1.22) (2018-01-28) 1508 | 1509 | 1510 | ### Bug Fixes 1511 | 1512 | * add peerDependencies ([6b15af1](https://github.com/oclif/command/commit/6b15af19cc146a9e7c7d9308dcc3f65ab4c38b0a)) 1513 | 1514 | 1515 | 1516 | ## [0.1.21](https://github.com/oclif/command/compare/v0.1.20...v0.1.21) (2018-01-28) 1517 | 1518 | 1519 | ### Bug Fixes 1520 | 1521 | * export convertToCachedCommand ([9bc563c](https://github.com/oclif/command/commit/9bc563c8f6e8f6647b32c1e0c52695634564b494)) 1522 | 1523 | 1524 | 1525 | ## [0.1.20](https://github.com/oclif/command/compare/v0.1.19...v0.1.20) (2018-01-28) 1526 | 1527 | 1528 | ### Bug Fixes 1529 | 1530 | * add convertToCached ([3fd39b9](https://github.com/oclif/command/commit/3fd39b9ecd0d60f6aa7e01874be7a8ded157a153)) 1531 | 1532 | 1533 | 1534 | ## [0.1.19](https://github.com/oclif/command/compare/v0.1.18...v0.1.19) (2018-01-27) 1535 | 1536 | 1537 | ### Bug Fixes 1538 | 1539 | * updated deps ([6430b69](https://github.com/oclif/command/commit/6430b695c01a5611a15b351a53609b38a7748018)) 1540 | 1541 | 1542 | 1543 | ## [0.1.18](https://github.com/oclif/command/compare/v0.1.17...v0.1.18) (2018-01-26) 1544 | 1545 | 1546 | ### Bug Fixes 1547 | 1548 | * updated config and cli-ux ([060534e](https://github.com/oclif/command/commit/060534e2632335e4915782afb7f36225ab140d15)) 1549 | 1550 | 1551 | 1552 | ## [0.1.17](https://github.com/oclif/command/compare/v0.1.16...v0.1.17) (2018-01-26) 1553 | 1554 | 1555 | ### Bug Fixes 1556 | 1557 | * set debug ([493ec08](https://github.com/oclif/command/commit/493ec082ec7062ee2f1235a7911a4b732d9de0d1)) 1558 | 1559 | 1560 | 1561 | ## [0.1.16](https://github.com/oclif/command/compare/v0.1.15...v0.1.16) (2018-01-26) 1562 | 1563 | 1564 | ### Bug Fixes 1565 | 1566 | * updated deps ([b5904ce](https://github.com/oclif/command/commit/b5904ceaa65551648ff8dfc29d6fb58f5207aa8d)) 1567 | 1568 | 1569 | 1570 | ## [0.1.15](https://github.com/oclif/command/compare/v0.1.14...v0.1.15) (2018-01-25) 1571 | 1572 | 1573 | ### Bug Fixes 1574 | 1575 | * updated config ([c81025c](https://github.com/oclif/command/commit/c81025c21e9e96f0c6317d3e57c72d1bfde78f07)) 1576 | 1577 | 1578 | 1579 | ## [0.1.14](https://github.com/oclif/command/compare/v0.1.13...v0.1.14) (2018-01-25) 1580 | 1581 | 1582 | ### Bug Fixes 1583 | 1584 | * added typedoc ([036950b](https://github.com/oclif/command/commit/036950b6cf0e5a59206039d32822817d2e58fee3)) 1585 | * ran generator ([92abb15](https://github.com/oclif/command/commit/92abb155388dbf367b6bf42c10b5d79ee84a8667)) 1586 | * updated deps ([3e18992](https://github.com/oclif/command/commit/3e18992ba8c05aeeea0baf4cb51613ae50bd1c55)) 1587 | 1588 | 1589 | 1590 | ## [0.1.13](https://github.com/oclif/command/compare/v0.1.12...v0.1.13) (2018-01-20) 1591 | 1592 | 1593 | ### Bug Fixes 1594 | 1595 | * remove http-call type ([9aac526](https://github.com/oclif/command/commit/9aac5264aa8f23b514295390afa8ecc1fb5e8142)) 1596 | 1597 | 1598 | 1599 | ## [0.1.12](https://github.com/oclif/command/compare/v0.1.11...v0.1.12) (2018-01-20) 1600 | 1601 | 1602 | ### Bug Fixes 1603 | 1604 | * updated deps ([db0b54a](https://github.com/oclif/command/commit/db0b54a6eccda027295b2d1d1449423d34cd7933)) 1605 | 1606 | 1607 | 1608 | ## [0.1.11](https://github.com/oclif/command/compare/v0.1.10...v0.1.11) (2018-01-20) 1609 | 1610 | 1611 | ### Bug Fixes 1612 | 1613 | * updated cli-ux ([2f11d05](https://github.com/oclif/command/commit/2f11d05476ba4be77aac0ceaf12c3e0893278c8c)) 1614 | 1615 | 1616 | 1617 | ## [0.1.10](https://github.com/oclif/command/compare/v0.1.9...v0.1.10) (2018-01-20) 1618 | 1619 | 1620 | ### Bug Fixes 1621 | 1622 | * updated cli-ux ([345a27b](https://github.com/oclif/command/commit/345a27b45287810bec0796ab00c89348095e196f)) 1623 | * updated cli-ux ([b0848e5](https://github.com/oclif/command/commit/b0848e51632f7329e8bb8901501b25dd77eafca2)) 1624 | 1625 | 1626 | 1627 | ## [0.1.9](https://github.com/oclif/command/compare/v0.1.8...v0.1.9) (2018-01-19) 1628 | 1629 | 1630 | ### Bug Fixes 1631 | 1632 | * hide EEXIT ([2184233](https://github.com/oclif/command/commit/2184233b76e311a84a76ac2d973a45760397bb5f)) 1633 | 1634 | 1635 | 1636 | ## [0.1.8](https://github.com/oclif/command/compare/v0.1.7...v0.1.8) (2018-01-19) 1637 | 1638 | 1639 | ### Bug Fixes 1640 | 1641 | * updated cli-ux ([30e1b12](https://github.com/oclif/command/commit/30e1b12a1a6d2359fb2c99391970f6ae44ae171c)) 1642 | 1643 | 1644 | 1645 | ## [0.1.7](https://github.com/oclif/command/compare/v0.1.6...v0.1.7) (2018-01-19) 1646 | 1647 | 1648 | ### Bug Fixes 1649 | 1650 | * yarn upgrade ([5a790b9](https://github.com/oclif/command/commit/5a790b9b3e3fb2a498e2a86043c2ea5f39ffec8f)) 1651 | 1652 | 1653 | 1654 | ## [0.1.6](https://github.com/oclif/command/compare/v0.1.5...v0.1.6) (2018-01-19) 1655 | 1656 | 1657 | ### Bug Fixes 1658 | 1659 | * make compatible with ICommand ([72798f5](https://github.com/oclif/command/commit/72798f58f713b0986470e10590b84354938b2fd2)) 1660 | 1661 | 1662 | 1663 | ## [0.1.5](https://github.com/oclif/command/compare/v0.1.4...v0.1.5) (2018-01-19) 1664 | 1665 | 1666 | ### Bug Fixes 1667 | 1668 | * added load function ([1aeeb61](https://github.com/oclif/command/commit/1aeeb6191eb81f8addc9bbad185a67a93d745937)) 1669 | 1670 | 1671 | 1672 | ## [0.1.4](https://github.com/oclif/command/compare/v0.1.3...v0.1.4) (2018-01-19) 1673 | 1674 | 1675 | ### Bug Fixes 1676 | 1677 | * always raise errors ([5a11723](https://github.com/oclif/command/commit/5a1172301bd5b9cb2c6c5d8acdd55de70169e87c)) 1678 | 1679 | 1680 | 1681 | ## [0.1.3](https://github.com/oclif/command/compare/v0.1.2...v0.1.3) (2018-01-19) 1682 | 1683 | 1684 | ### Bug Fixes 1685 | 1686 | * updated cli-ux ([9c9cecf](https://github.com/oclif/command/commit/9c9cecf61278ad5b8d863ddc68c76c24a6768c97)) 1687 | 1688 | 1689 | 1690 | ## [0.1.2](https://github.com/oclif/command/compare/v0.1.1...v0.1.2) (2018-01-19) 1691 | 1692 | 1693 | ### Bug Fixes 1694 | 1695 | * update config ([4590963](https://github.com/oclif/command/commit/45909633097d25a0e5fd2e277e8fd50338e3f2b6)) 1696 | 1697 | 1698 | 1699 | ## [0.1.1](https://github.com/oclif/command/compare/v0.1.0...v0.1.1) (2018-01-19) 1700 | 1701 | 1702 | ### Bug Fixes 1703 | 1704 | * updated dependencies ([1f7deb2](https://github.com/oclif/command/commit/1f7deb2af526ce428d87576a48403f5c6945b33f)) 1705 | 1706 | 1707 | 1708 | # [0.1.0](https://github.com/oclif/command/compare/v0.0.0...v0.1.0) (2018-01-16) 1709 | 1710 | 1711 | ### Bug Fixes 1712 | 1713 | * updated cli-ux ([7a4f576](https://github.com/oclif/command/commit/7a4f576ecb4a24debb1b1d1554d9c7918e2ee235)) 1714 | 1715 | 1716 | ### Features 1717 | 1718 | * implemented base commad ([7fc7932](https://github.com/oclif/command/commit/7fc79327594129a6d07d0388a02371d917afbc05)) 1719 | 1720 | 1721 | 1722 | # 0.0.0 (2018-01-14) 1723 | 1724 | 1725 | 1726 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Salesforce.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | @oclif/command 2 | =============== 3 | 4 | **This library been replaced by [@oclif/core](https://github.com/oclif/core) and is no longer maintained** 5 | 6 | oclif base command 7 | 8 | [![Version](https://img.shields.io/npm/v/@oclif/command.svg)](https://npmjs.org/package/@oclif/command) 9 | [![CircleCI](https://circleci.com/gh/oclif/command/tree/main.svg?style=shield)](https://circleci.com/gh/oclif/command/tree/main) 10 | [![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/oclif/command?branch=main&svg=true)](https://ci.appveyor.com/project/heroku/command/branch/main) 11 | [![Known Vulnerabilities](https://snyk.io/test/npm/@oclif/command/badge.svg)](https://snyk.io/test/npm/@oclif/command) 12 | [![Downloads/week](https://img.shields.io/npm/dw/@oclif/command.svg)](https://npmjs.org/package/@oclif/command) 13 | [![License](https://img.shields.io/npm/l/@oclif/command.svg)](https://github.com/oclif/command/blob/main/package.json) 14 | 15 | This is about half of the main codebase for oclif. The other half lives in [@oclif/config](https://github.com/oclif/config). This can be used directly, but it probably makes more sense to build your CLI with the [generator](https://github.com/oclif/oclif). 16 | 17 | Usage 18 | ===== 19 | 20 | Without the generator, you can create a simple CLI like this: 21 | 22 | **TypeScript** 23 | ```js 24 | #!/usr/bin/env ts-node 25 | 26 | import * as fs from 'fs' 27 | import {Command, flags} from '@oclif/command' 28 | 29 | class LS extends Command { 30 | static flags = { 31 | version: flags.version(), 32 | help: flags.help(), 33 | // run with --dir= or -d= 34 | dir: flags.string({ 35 | char: 'd', 36 | default: process.cwd(), 37 | }), 38 | } 39 | 40 | async run() { 41 | const {flags} = this.parse(LS) 42 | let files = fs.readdirSync(flags.dir) 43 | for (let f of files) { 44 | this.log(f) 45 | } 46 | } 47 | } 48 | 49 | LS.run() 50 | .catch(require('@oclif/errors/handle')) 51 | ``` 52 | 53 | **JavaScript** 54 | ```js 55 | #!/usr/bin/env node 56 | 57 | const fs = require('fs') 58 | const {Command, flags} = require('@oclif/command') 59 | 60 | class LS extends Command { 61 | async run() { 62 | const {flags} = this.parse(LS) 63 | let files = fs.readdirSync(flags.dir) 64 | for (let f of files) { 65 | this.log(f) 66 | } 67 | } 68 | } 69 | 70 | LS.flags = { 71 | version: flags.version(), 72 | help: flags.help(), 73 | // run with --dir= or -d= 74 | dir: flags.string({ 75 | char: 'd', 76 | default: process.cwd(), 77 | }), 78 | } 79 | 80 | LS.run() 81 | .catch(require('@oclif/errors/handle')) 82 | ``` 83 | 84 | Then run either of these with: 85 | 86 | ```sh-session 87 | $ ./myscript 88 | ...files in current dir... 89 | $ ./myscript --dir foobar 90 | ...files in ./foobar... 91 | $ ./myscript --version 92 | myscript/0.0.0 darwin-x64 node-v9.5.0 93 | $ ./myscript --help 94 | USAGE 95 | $ @oclif/command 96 | 97 | OPTIONS 98 | -d, --dir=dir [default: /Users/jdickey/src/github.com/oclif/command] 99 | --help show CLI help 100 | --version show CLI version 101 | ``` 102 | 103 | See the [generator](https://github.com/oclif/oclif) for all the options you can pass to the command. 104 | -------------------------------------------------------------------------------- /bin/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('ts-node/register') 4 | require('../src').run() 5 | .then(require('../flush')) 6 | .catch(require('@oclif/errors/handle')) 7 | 8 | // const {Command, flags, parse} = require('../src') 9 | 10 | // class TestCommand extends Command { 11 | // async run() { 12 | // this.info('running test command') 13 | // } 14 | // } 15 | 16 | // TestCommand.run() 17 | -------------------------------------------------------------------------------- /bin/run.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | node "%~dp0\run" %* 4 | -------------------------------------------------------------------------------- /example/ls.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ts-node 2 | 3 | import * as fs from 'fs' 4 | 5 | import Command, {flags} from '..' // use @oclif/command outside this repo 6 | 7 | class LS extends Command { 8 | static flags = { 9 | version: flags.version(), 10 | help: flags.help(), 11 | // run with --dir= or -d= 12 | dir: flags.string({ 13 | char: 'd', 14 | default: process.cwd(), 15 | required: true, 16 | }), 17 | } 18 | 19 | async run() { 20 | const {flags} = this.parse(LS) 21 | const files = fs.readdirSync(flags.dir) 22 | for (const f of files) { 23 | this.log(f) 24 | } 25 | } 26 | } 27 | 28 | LS.run() 29 | .then(() => {}, require('@oclif/errors/handle')) 30 | -------------------------------------------------------------------------------- /example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig", 3 | "compilerOptions": { 4 | "rootDir": ".." 5 | }, 6 | "include": [ 7 | "../examples/**/*", 8 | "../src/**/*", 9 | "../test/**/*" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /flush.d.ts: -------------------------------------------------------------------------------- 1 | declare const flush: () => Promise 2 | 3 | export = flush 4 | -------------------------------------------------------------------------------- /flush.js: -------------------------------------------------------------------------------- 1 | module.exports = async () => { 2 | try { 3 | const {ux} = require('cli-ux') 4 | await ux.flush() 5 | } catch (err) {} 6 | } 7 | -------------------------------------------------------------------------------- /git2gus/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "productTag": "a1aB00000004Bx8IAE", 3 | "defaultBuild": "offcore.tooling.55" 4 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@oclif/command", 3 | "description": "oclif base command", 4 | "version": "1.8.36", 5 | "author": "Salesforce", 6 | "bugs": "https://github.com/oclif/command/issues", 7 | "dependencies": { 8 | "@oclif/config": "^1.18.2", 9 | "@oclif/errors": "^1.3.6", 10 | "@oclif/parser": "^3.8.17", 11 | "@oclif/help": "^1.0.1", 12 | "debug": "^4.1.1", 13 | "semver": "^7.5.4" 14 | }, 15 | "devDependencies": { 16 | "@oclif/plugin-plugins": "1.10.10", 17 | "@types/chai": "^4.3.5", 18 | "@types/mocha": "^8.0.0", 19 | "@types/node": "^14.18.54", 20 | "@types/semver": "^7.5.0", 21 | "chai": "^4.3.7", 22 | "cli-ux": "^5.6.6", 23 | "conventional-changelog-cli": "^2.2.2", 24 | "eslint": "^7.3.1", 25 | "eslint-config-oclif": "^3.1.0", 26 | "eslint-config-oclif-typescript": "^0.2.0", 27 | "fancy-test": "^1.4.3", 28 | "globby": "^11.1.0", 29 | "mocha": "^8.2.1", 30 | "sinon": "^10.0.0", 31 | "ts-node": "^9.1.1", 32 | "typescript": "3.9.10" 33 | }, 34 | "peerDependencies": { 35 | "@oclif/config": "^1" 36 | }, 37 | "engines": { 38 | "node": ">=12.0.0" 39 | }, 40 | "files": [ 41 | "/flush.js", 42 | "/flush.d.ts", 43 | "/lib" 44 | ], 45 | "homepage": "https://github.com/oclif/command", 46 | "keywords": [ 47 | "oclif" 48 | ], 49 | "license": "MIT", 50 | "main": "lib/index.js", 51 | "oclif": { 52 | "devPlugins": [ 53 | "@oclif/plugin-plugins" 54 | ] 55 | }, 56 | "repository": "oclif/command", 57 | "scripts": { 58 | "build": "rm -rf lib && tsc", 59 | "lint": "eslint . --ext .ts --config .eslintrc", 60 | "posttest": "yarn lint", 61 | "prepublishOnly": "yarn run build", 62 | "test": "mocha --forbid-only \"test/**/*.test.ts\"", 63 | "version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md", 64 | "pretest": "yarn build --noEmit && tsc -p test --noEmit" 65 | }, 66 | "types": "lib/index.d.ts" 67 | } -------------------------------------------------------------------------------- /src/command.ts: -------------------------------------------------------------------------------- 1 | const pjson = require('../package.json') 2 | import * as Config from '@oclif/config' 3 | import * as Errors from '@oclif/errors' 4 | import * as Parser from '@oclif/parser' 5 | import {HelpBase, getHelpClass} from '@oclif/help' 6 | import {format, inspect} from 'util' 7 | 8 | import * as flags from './flags' 9 | import {sortBy, uniqBy} from './util' 10 | import {PrettyPrintableError} from '@oclif/errors' 11 | 12 | /** 13 | * swallows stdout epipe errors 14 | * this occurs when stdout closes such as when piping to head 15 | */ 16 | process.stdout.on('error', err => { 17 | if (err && err.code === 'EPIPE') 18 | return 19 | throw err 20 | }) 21 | 22 | /** 23 | * An abstract class which acts as the base for each command 24 | * in your project. 25 | */ 26 | 27 | export default abstract class Command { 28 | static _base = `${pjson.name}@${pjson.version}` 29 | 30 | /** A command ID, used mostly in error or verbose reporting */ 31 | static id: string 32 | 33 | // to-do: Confirm unused? 34 | static title: string | undefined 35 | 36 | /** 37 | * The tweet-sized description for your class, used in a parent-commands 38 | * sub-command listing and as the header for the command help 39 | */ 40 | static description: string | undefined 41 | 42 | /** hide the command from help? */ 43 | static hidden: boolean 44 | 45 | /** An override string (or strings) for the default usage documentation */ 46 | static usage: string | string[] | undefined 47 | 48 | static help: string | undefined 49 | 50 | /** An array of aliases for this command */ 51 | static aliases: string[] = [] 52 | 53 | /** When set to false, allows a variable amount of arguments */ 54 | static strict = true 55 | 56 | static parse = true 57 | 58 | /** A hash of flags for the command */ 59 | static flags?: flags.Input 60 | 61 | /** An order-dependent array of arguments for the command */ 62 | static args?: Parser.args.Input 63 | 64 | static plugin: Config.IPlugin | undefined 65 | 66 | /** An array of example strings to show at the end of the command's help */ 67 | static examples: string[] | undefined 68 | 69 | static parserOptions = {} 70 | 71 | /** 72 | * instantiate and run the command 73 | * @param {Config.Command.Class} this Class 74 | * @param {string[]} argv argv 75 | * @param {Config.LoadOptions} opts options 76 | * @returns Promise 77 | */ 78 | static run: Config.Command.Class['run'] = async function (this: Config.Command.Class, argv?: string[], opts?) { 79 | if (!argv) argv = process.argv.slice(2) 80 | const config = await Config.load(opts || (module.parent && module.parent.parent && module.parent.parent.filename) || __dirname) 81 | const cmd = new this(argv, config) 82 | return cmd._run(argv) 83 | } 84 | 85 | id: string | undefined 86 | 87 | protected debug: (...args: any[]) => void 88 | 89 | constructor(public argv: string[], public config: Config.IConfig) { 90 | this.id = this.ctor.id 91 | try { 92 | this.debug = require('debug')(this.id ? `${this.config.bin}:${this.id}` : this.config.bin) 93 | } catch { 94 | this.debug = () => {} 95 | } 96 | } 97 | 98 | get ctor(): typeof Command { 99 | return this.constructor as typeof Command 100 | } 101 | 102 | async _run(): Promise { 103 | let err: Error | undefined 104 | try { 105 | // remove redirected env var to allow subsessions to run autoupdated client 106 | delete process.env[this.config.scopedEnvVarKey('REDIRECTED')] 107 | 108 | await this.init() 109 | return await this.run() 110 | } catch (error) { 111 | err = error 112 | await this.catch(error) 113 | } finally { 114 | await this.finally(err) 115 | } 116 | } 117 | 118 | exit(code = 0) { 119 | return Errors.exit(code) 120 | } 121 | 122 | warn(input: string | Error) { 123 | Errors.warn(input) 124 | } 125 | 126 | error(input: string | Error, options: {code?: string; exit: false} & PrettyPrintableError): void 127 | 128 | error(input: string | Error, options?: {code?: string; exit?: number} & PrettyPrintableError): never 129 | 130 | error(input: string | Error, options: {code?: string; exit?: number | false} & PrettyPrintableError = {}) { 131 | return Errors.error(input, options as any) 132 | } 133 | 134 | log(message = '', ...args: any[]) { 135 | // tslint:disable-next-line strict-type-predicates 136 | message = typeof message === 'string' ? message : inspect(message) 137 | process.stdout.write(format(message, ...args) + '\n') 138 | } 139 | 140 | /** 141 | * actual command run code goes here 142 | */ 143 | abstract run(): PromiseLike 144 | 145 | protected async init(): Promise { 146 | this.debug('init version: %s argv: %o', this.ctor._base, this.argv) 147 | if (this.config.debug) Errors.config.debug = true 148 | if (this.config.errlog) Errors.config.errlog = this.config.errlog 149 | // global['cli-ux'].context = global['cli-ux'].context || { 150 | // command: compact([this.id, ...this.argv]).join(' '), 151 | // version: this.config.userAgent, 152 | // } 153 | const g: any = global 154 | g['http-call'] = g['http-call'] || {} 155 | g['http-call']!.userAgent = this.config.userAgent 156 | if (this._helpOverride()) return this._help() 157 | } 158 | 159 | protected parse(options?: Parser.Input, argv = this.argv): Parser.Output { 160 | if (!options) options = this.constructor as any 161 | return require('@oclif/parser').parse(argv, {context: this, ...options}) 162 | } 163 | 164 | protected async catch(err: any): Promise { 165 | if (!err.message) throw err 166 | if (err.message.match(/Unexpected arguments?: (-h|--help|help)(,|\n)/)) { 167 | return this._help() 168 | } 169 | 170 | if (err.message.match(/Unexpected arguments?: (-v|--version|version)(,|\n)/)) { 171 | return this._version() 172 | } 173 | 174 | try { 175 | const {cli} = require('cli-ux') 176 | const chalk = require('chalk') // eslint-disable-line node/no-extraneous-require 177 | cli.action.stop(chalk.bold.red('!')) 178 | } catch {} 179 | 180 | throw err 181 | } 182 | 183 | protected async finally(_: Error | undefined): Promise { 184 | try { 185 | const config = require('@oclif/errors').config 186 | if (config.errorLogger) await config.errorLogger.flush() 187 | // tslint:disable-next-line no-console 188 | } catch (error) { 189 | console.error(error) 190 | } 191 | } 192 | 193 | protected _help() { 194 | const HelpClass = getHelpClass(this.config) 195 | const help: HelpBase = new HelpClass(this.config) 196 | const cmd = Config.Command.toCached(this.ctor as any as Config.Command.Class) 197 | if (!cmd.id) cmd.id = '' 198 | let topics = this.config.topics 199 | topics = topics.filter((t: any) => !t.hidden) 200 | topics = sortBy(topics, (t: any) => t.name) 201 | topics = uniqBy(topics, (t: any) => t.name) 202 | help.showCommandHelp(cmd, topics) 203 | return this.exit(0) 204 | } 205 | 206 | protected _helpOverride(): boolean { 207 | for (const arg of this.argv) { 208 | if (arg === '--help') return true 209 | if (arg === '--') return false 210 | } 211 | 212 | return false 213 | } 214 | 215 | protected _version() { 216 | this.log(this.config.userAgent) 217 | return this.exit(0) 218 | } 219 | } 220 | -------------------------------------------------------------------------------- /src/flags.ts: -------------------------------------------------------------------------------- 1 | import {IConfig} from '@oclif/config' 2 | import * as Parser from '@oclif/parser' 3 | 4 | import {Command} from '.' 5 | 6 | export type ICompletionContext = { 7 | args?: { [name: string]: string }; 8 | flags?: { [name: string]: string }; 9 | argv?: string[]; 10 | config: IConfig; 11 | } 12 | 13 | export type ICompletion = { 14 | skipCache?: boolean; 15 | cacheDuration?: number; 16 | cacheKey?(ctx: ICompletionContext): Promise; 17 | options(ctx: ICompletionContext): Promise; 18 | } 19 | 20 | export type IOptionFlag = Parser.flags.IOptionFlag & { 21 | completion?: ICompletion; 22 | } 23 | 24 | export type IFlag = Parser.flags.IBooleanFlag | IOptionFlag 25 | 26 | export type Output = Parser.flags.Output 27 | export type Input = { [P in keyof T]: IFlag } 28 | 29 | export type Definition = { 30 | (options: {multiple: true} & Partial>): IOptionFlag; 31 | (options: ({required: true} | {default: Parser.flags.Default}) & Partial>): IOptionFlag; 32 | (options?: Partial>): IOptionFlag; 33 | } 34 | 35 | export function build(defaults: {parse: IOptionFlag['parse']} & Partial>): Definition 36 | export function build(defaults: Partial>): Definition 37 | export function build(defaults: Partial>): Definition { 38 | return Parser.flags.build(defaults as any) 39 | } 40 | 41 | export function option(options: {parse: IOptionFlag['parse']} & Partial>) { 42 | return build(options)() 43 | } 44 | 45 | const _enum = (opts: Parser.flags.EnumFlagOptions): IOptionFlag => { 46 | return build({ 47 | parse(input) { 48 | if (!opts.options.includes(input)) throw new Error(`Expected --${this.name}=${input} to be one of: ${opts.options.join(', ')}`) 49 | return input as unknown as T 50 | }, 51 | helpValue: `(${opts.options.join('|')})`, 52 | ...opts, 53 | })() as IOptionFlag 54 | } 55 | 56 | export {_enum as enum} 57 | 58 | const stringFlag = build({}) 59 | export {stringFlag as string} 60 | export {boolean, integer} from '@oclif/parser/lib/flags' 61 | 62 | export const version = (opts: Partial> = {}) => { 63 | return Parser.flags.boolean({ 64 | // char: 'v', 65 | description: 'show CLI version', 66 | ...opts, 67 | parse: (_: any, cmd: Command) => { 68 | cmd.log(cmd.config.userAgent) 69 | cmd.exit(0) 70 | }, 71 | }) 72 | } 73 | 74 | export const help = (opts: Partial> = {}) => { 75 | return Parser.flags.boolean({ 76 | // char: 'h', 77 | description: 'show CLI help', 78 | ...opts, 79 | parse: (_: any, cmd: Command) => { 80 | (cmd as any)._help() 81 | }, 82 | }) 83 | } 84 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path' 2 | import * as semver from 'semver' 3 | 4 | function checkCWD() { 5 | try { 6 | process.cwd() 7 | } catch (error) { 8 | if (error.code === 'ENOENT') { 9 | process.stderr.write('WARNING: current directory does not exist\n') 10 | } 11 | } 12 | } 13 | 14 | function checkNodeVersion() { 15 | const root = path.join(__dirname, '..') 16 | const pjson = require(path.join(root, 'package.json')) 17 | if (!semver.satisfies(process.versions.node, pjson.engines.node)) { 18 | process.stderr.write(`WARNING\nWARNING Node version must be ${pjson.engines.node} to use this CLI\nWARNING Current node version: ${process.versions.node}\nWARNING\n`) 19 | } 20 | } 21 | 22 | checkCWD() 23 | checkNodeVersion() 24 | 25 | import Command from './command' 26 | import * as flags from './flags' 27 | export {run, Main} from './main' 28 | 29 | export default Command 30 | export { 31 | Command, 32 | flags, 33 | } 34 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import * as Config from '@oclif/config' 2 | import {HelpBase, getHelpClass} from '@oclif/help' 3 | 4 | import Command from './command' 5 | 6 | const ROOT_INDEX_CMD_ID = '' 7 | 8 | export class Main extends Command { 9 | static run(argv = process.argv.slice(2), options?: Config.LoadOptions) { 10 | return super.run(argv, options || (module.parent && module.parent.parent && module.parent.parent.filename) || __dirname) 11 | } 12 | 13 | async init() { 14 | const [id, ...argv] = this.argv 15 | await this.config.runHook('init', {id, argv}) 16 | return super.init() 17 | } 18 | 19 | async run() { 20 | let [id, ...argv] = this.argv 21 | this.parse({strict: false, '--': false, ...this.ctor as any}) 22 | if (!this.config.findCommand(id)) { 23 | const topic = this.config.findTopic(id) 24 | if (topic) return this._help() 25 | if (this.config.findCommand(ROOT_INDEX_CMD_ID)) { 26 | id = ROOT_INDEX_CMD_ID 27 | argv = this.argv 28 | } 29 | } 30 | 31 | await this.config.runCommand(id, argv) 32 | } 33 | 34 | protected _helpOverride(): boolean { 35 | if (['-v', '--version', 'version'].includes(this.argv[0])) return this._version() as any 36 | if (['-h', 'help'].includes(this.argv[0])) return true 37 | if (this.argv.length === 0 && !this.config.findCommand(ROOT_INDEX_CMD_ID)) return true 38 | for (const arg of this.argv) { 39 | if (arg === '--help') return true 40 | if (arg === '--') return false 41 | } 42 | 43 | return false 44 | } 45 | 46 | protected _help() { 47 | const HelpClass = getHelpClass(this.config) 48 | const help: HelpBase = new HelpClass(this.config) 49 | help.showHelp(this.argv) 50 | return this.exit(0) 51 | } 52 | } 53 | 54 | export function run(argv = process.argv.slice(2), options?: Config.LoadOptions) { 55 | return Main.run(argv, options) 56 | } 57 | -------------------------------------------------------------------------------- /src/util.ts: -------------------------------------------------------------------------------- 1 | export function compact(a: (T | undefined)[]): T[] { 2 | return a.filter((a): a is T => Boolean(a)) 3 | } 4 | 5 | export function uniqBy(arr: T[], fn: (cur: T) => any): T[] { 6 | return arr.filter((a, i) => { 7 | const aVal = fn(a) 8 | return !arr.find((b, j) => j > i && fn(b) === aVal) 9 | }) 10 | } 11 | 12 | export namespace sort { 13 | export type Types = string | number | undefined | boolean 14 | } 15 | 16 | export function sortBy(arr: T[], fn: (i: T) => sort.Types | sort.Types[]): T[] { 17 | function compare(a: sort.Types | sort.Types[], b: sort.Types | sort.Types[]): number { 18 | a = a === undefined ? 0 : a 19 | b = b === undefined ? 0 : b 20 | 21 | if (Array.isArray(a) && Array.isArray(b)) { 22 | if (a.length === 0 && b.length === 0) return 0 23 | const diff = compare(a[0], b[0]) 24 | if (diff !== 0) return diff 25 | return compare(a.slice(1), b.slice(1)) 26 | } 27 | 28 | if (a < b) return -1 29 | if (a > b) return 1 30 | return 0 31 | } 32 | 33 | return arr.sort((a, b) => compare(fn(a), fn(b))) 34 | } 35 | -------------------------------------------------------------------------------- /test/command.test.ts: -------------------------------------------------------------------------------- 1 | import * as Config from '@oclif/config' 2 | import {expect, fancy} from 'fancy-test' 3 | 4 | import Base, {flags} from '../src' 5 | import {TestHelpClassConfig} from './helpers/test-help-in-src/src/test-help-plugin' 6 | import * as OclifHelp from '@oclif/help' 7 | 8 | const originalgetHelpClass = OclifHelp.getHelpClass 9 | 10 | // const pjson = require('../package.json') 11 | 12 | class Command extends Base { 13 | static description = 'test command' 14 | 15 | async run() { 16 | this.parse() 17 | this.log('foo') 18 | } 19 | } 20 | 21 | class CodeError extends Error { 22 | constructor(private readonly code: string) { 23 | super(code) 24 | } 25 | } 26 | 27 | describe('command', () => { 28 | fancy 29 | .stdout() 30 | .do(() => Command.run([])) 31 | .do(output => expect(output.stdout).to.equal('foo\n')) 32 | .it('logs to stdout') 33 | 34 | fancy 35 | .do(async () => { 36 | class Command extends Base { 37 | static description = 'test command' 38 | 39 | async run() { 40 | return 101 41 | } 42 | } 43 | 44 | expect(await Command.run([])).to.equal(101) 45 | }) 46 | .it('returns value') 47 | 48 | fancy 49 | .do(() => { 50 | class Command extends Base { 51 | async run() { 52 | throw new Error('new x error') 53 | } 54 | } 55 | 56 | return Command.run([]) 57 | }) 58 | .catch(/new x error/) 59 | .it('errors out') 60 | 61 | fancy 62 | .stdout() 63 | .do(() => { 64 | class Command extends Base { 65 | async run() { 66 | this.exit(0) 67 | } 68 | } 69 | return Command.run([]) 70 | }) 71 | .catch(/EEXIT: 0/) 72 | .it('exits with 0') 73 | 74 | describe('convertToCached', () => { 75 | fancy 76 | // .skip() 77 | // .do(async () => { 78 | // class C extends Command { 79 | // static title = 'cmd title' 80 | // static type = 'mytype' 81 | // static usage = ['$ usage'] 82 | // static description = 'test command' 83 | // static aliases = ['alias1', 'alias2'] 84 | // static hidden = true 85 | // static flags = { 86 | // flaga: flags.boolean(), 87 | // flagb: flags.string({ 88 | // char: 'b', 89 | // hidden: true, 90 | // required: false, 91 | // description: 'flagb desc', 92 | // options: ['a', 'b'], 93 | // default: () => 'mydefault', 94 | // }), 95 | // } 96 | // static args = [ 97 | // { 98 | // name: 'arg1', 99 | // description: 'arg1 desc', 100 | // required: true, 101 | // hidden: false, 102 | // options: ['af', 'b'], 103 | // default: () => 'myadefault', 104 | // } 105 | // ] 106 | // } 107 | // const c = Config.Command.toCached(C) 108 | // expect(await c.load()).to.have.property('run') 109 | // delete c.load 110 | // expect(c).to.deep.equal({ 111 | // _base: `@oclif/command@${pjson.version}`, 112 | // id: 'foo:bar', 113 | // type: 'mytype', 114 | // hidden: true, 115 | // pluginName: undefined, 116 | // description: 'test command', 117 | // aliases: ['alias1', 'alias2'], 118 | // title: 'cmd title', 119 | // usage: ['$ usage'], 120 | // flags: { 121 | // flaga: { 122 | // char: undefined, 123 | // description: undefined, 124 | // name: 'flaga', 125 | // hidden: undefined, 126 | // required: undefined, 127 | // type: 'boolean', 128 | // }, 129 | // flagb: { 130 | // char: 'b', 131 | // description: 'flagb desc', 132 | // name: 'flagb', 133 | // hidden: true, 134 | // required: false, 135 | // type: 'option', 136 | // helpValue: undefined, 137 | // default: 'mydefault', 138 | // options: ['a', 'b'], 139 | // } 140 | // }, 141 | // args: [ 142 | // { 143 | // description: 'arg1 desc', 144 | // name: 'arg1', 145 | // hidden: false, 146 | // required: true, 147 | // options: ['af', 'b'], 148 | // default: 'myadefault', 149 | // } 150 | // ], 151 | // }) 152 | // }) 153 | .it('converts to cached with everything set') 154 | 155 | fancy 156 | // .skip() 157 | .do(async () => { 158 | // const c = class extends Command { 159 | // }.convertToCached() 160 | // expect(await c.load()).to.have.property('run') 161 | // delete c.load 162 | // expect(c).to.deep.equal({ 163 | // _base: `@oclif/command@${pjson.version}`, 164 | // id: undefined, 165 | // type: undefined, 166 | // hidden: undefined, 167 | // pluginName: undefined, 168 | // description: 'test command', 169 | // aliases: [], 170 | // title: undefined, 171 | // usage: undefined, 172 | // flags: {}, 173 | // args: [], 174 | // }) 175 | }) 176 | 177 | .it('adds plugin name') 178 | 179 | fancy 180 | // .skip() 181 | // .do(async () => { 182 | // const c = class extends Command { 183 | // }.convertToCached({pluginName: 'myplugin'}) 184 | // expect(await c.load()).to.have.property('run') 185 | // delete c.load 186 | // expect(c).to.deep.equal({ 187 | // _base: `@oclif/command@${pjson.version}`, 188 | // type: undefined, 189 | // id: undefined, 190 | // hidden: undefined, 191 | // pluginName: 'myplugin', 192 | // description: 'test command', 193 | // aliases: [], 194 | // title: undefined, 195 | // usage: undefined, 196 | // flags: {}, 197 | // args: [], 198 | // }) 199 | // }) 200 | .it('converts to cached with nothing set') 201 | }) 202 | 203 | describe('parse', () => { 204 | fancy 205 | .stdout() 206 | .it('has a flag', async ctx => { 207 | class CMD extends Base { 208 | static flags = { 209 | foo: flags.string(), 210 | } 211 | 212 | async run() { 213 | const {flags} = this.parse(CMD) 214 | this.log(flags.foo) 215 | } 216 | } 217 | 218 | await CMD.run(['--foo=bar']) 219 | expect(ctx.stdout).to.equal('bar\n') 220 | }) 221 | }) 222 | 223 | describe('version', () => { 224 | fancy 225 | .stdout() 226 | .add('config', () => Config.load()) 227 | .do(async () => { 228 | await Command.run(['--version']) 229 | }) 230 | .catch(/EEXIT: 0/) 231 | .it('shows version', ctx => { 232 | expect(ctx.stdout).to.equal(`${ctx.config.userAgent}\n`) 233 | }) 234 | }) 235 | 236 | describe('help', () => { 237 | fancy 238 | .stdout() 239 | .do(() => { 240 | class CMD extends Command { 241 | static flags = {help: flags.help()} 242 | } 243 | return CMD.run(['--help']) 244 | }) 245 | .catch(/EEXIT: 0/) 246 | .it('--help', ctx => { 247 | expect(ctx.stdout).to.equal(`test command 248 | 249 | USAGE 250 | $ @oclif/command 251 | 252 | OPTIONS 253 | --help show CLI help 254 | 255 | `) 256 | }) 257 | 258 | fancy 259 | .stdout() 260 | .do(async () => { 261 | class CMD extends Command {} 262 | await CMD.run(['-h']) 263 | }) 264 | .catch(/EEXIT: 0/) 265 | .it('-h', ctx => { 266 | // expect(process.exitCode).to.equal(0) 267 | expect(ctx.stdout).to.equal(`test command 268 | 269 | USAGE 270 | $ @oclif/command 271 | 272 | `) 273 | }) 274 | 275 | fancy 276 | .stdout() 277 | .add('config', async () => { 278 | const config: TestHelpClassConfig = await Config.load() 279 | config.pjson.oclif.helpClass = 'help-class-does-not-exist' 280 | return config 281 | }) 282 | .do(async ({config}) => { 283 | class CMD extends Command { 284 | config = config 285 | } 286 | await CMD.run(['-h']) 287 | }) 288 | .catch((error: Error) => expect(error.message).to.contain('Unable to load configured help class "help-class-does-not-exist", failed with message:\n')) 289 | .it('shows useful error message when configured help class cannot be loaded') 290 | 291 | fancy 292 | .stdout() 293 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 294 | // @ts-ignore 295 | .stub(OclifHelp, 'getHelpClass', function (config: any) { 296 | return originalgetHelpClass(config, '') 297 | }) 298 | .add('config', async () => { 299 | const config: TestHelpClassConfig = await Config.load() 300 | config.pjson.oclif.helpClass = undefined 301 | return config 302 | }) 303 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 304 | // @ts-ignore 305 | .do(async ({config}) => { 306 | class CMD extends Command { 307 | config = config 308 | } 309 | await CMD.run(['-h']) 310 | }) 311 | .catch((error: Error) => expect(error.message).to.contain('Could not load a help class, consider installing the @oclif/help package, failed with message:\n')) 312 | .it('shows useful error message when no help class has been configured and the default cannot be loaded') 313 | 314 | describe('from a help class', () => { 315 | fancy 316 | .stdout() 317 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 318 | // @ts-ignore 319 | .stub(OclifHelp, 'getHelpClass', function (config: Config.IConfig) { 320 | const patchedConfig = { 321 | ...config, 322 | root: `${__dirname}/helpers/test-help-in-lib/`, 323 | } 324 | 325 | return originalgetHelpClass(patchedConfig) 326 | }) 327 | .add('config', async () => { 328 | const config: TestHelpClassConfig = await Config.load() 329 | config.pjson.oclif.helpClass = './lib/test-help-plugin' 330 | return config 331 | }) 332 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 333 | // @ts-ignore 334 | .do(async ({config}) => { 335 | class CMD extends Command { 336 | static id = 'test-command-for-help-plugin' 337 | 338 | config = config 339 | } 340 | await CMD.run(['-h']) 341 | }) 342 | .catch(/EEXIT: 0/) 343 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 344 | // @ts-ignore 345 | .it('-h via a plugin in lib dir (compiled to js)', ctx => { 346 | expect(ctx.stdout).to.equal('hello from test-help-plugin #showCommandHelp in the lib folder and in compiled javascript\n') 347 | expect(ctx.config.showCommandHelpSpy!.getCalls().length).to.equal(1) 348 | expect(ctx.config.showHelpSpy!.getCalls().length).to.equal(0) 349 | const [Command, Topics] = ctx.config.showCommandHelpSpy!.firstCall.args 350 | expect(Command.id).to.deep.equal('test-command-for-help-plugin') 351 | expect(Topics).to.be.an('array') 352 | }) 353 | 354 | fancy 355 | .stdout() 356 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 357 | // @ts-ignore 358 | .stub(OclifHelp, 'getHelpClass', function (config: Config.IConfig) { 359 | const patchedConfig = { 360 | ...config, 361 | root: `${__dirname}/helpers/test-help-in-src/`, 362 | } 363 | 364 | return originalgetHelpClass(patchedConfig) 365 | }) 366 | .add('config', async () => { 367 | const config: TestHelpClassConfig = await Config.load() 368 | config.pjson.oclif.helpClass = './lib/test-help-plugin' 369 | return config 370 | }) 371 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 372 | // @ts-ignore 373 | .do(async ({config}) => { 374 | class CMD extends Command { 375 | static id = 'test-command-for-help-plugin' 376 | 377 | config = config 378 | } 379 | await CMD.run(['-h']) 380 | }) 381 | .catch(/EEXIT: 0/) 382 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 383 | // @ts-ignore 384 | .it('-h via a plugin in src dir (source in ts)', ctx => { 385 | expect(ctx.stdout).to.equal('hello from test-help-plugin #showCommandHelp\n') 386 | expect(ctx.config.showCommandHelpSpy!.getCalls().length).to.equal(1) 387 | expect(ctx.config.showHelpSpy!.getCalls().length).to.equal(0) 388 | const [Command, Topics] = ctx.config.showCommandHelpSpy!.firstCall.args 389 | expect(Command.id).to.deep.equal('test-command-for-help-plugin') 390 | expect(Topics).to.be.an('array') 391 | }) 392 | 393 | fancy 394 | .stdout() 395 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 396 | // @ts-ignore 397 | .stub(OclifHelp, 'getHelpClass', function (config: Config.IConfig) { 398 | const patchedConfig = { 399 | ...config, 400 | root: `${__dirname}/helpers/test-help-in-src/`, 401 | } 402 | 403 | return originalgetHelpClass(patchedConfig) 404 | }) 405 | .add('config', async () => { 406 | const config: TestHelpClassConfig = await Config.load() 407 | config.pjson.oclif.helpClass = './lib/test-help-plugin' 408 | return config 409 | }) 410 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 411 | // @ts-ignore 412 | .do(async ({config}) => { 413 | class CMD extends Command { 414 | static id = 'test-command-for-help-plugin' 415 | 416 | config = config 417 | 418 | static flags = {help: flags.help()} 419 | } 420 | return CMD.run(['--help']) 421 | }) 422 | .catch(/EEXIT: 0/) 423 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 424 | // @ts-ignore 425 | .it('--help via a plugin in src dir (source in ts)', ctx => { 426 | expect(ctx.stdout).to.equal('hello from test-help-plugin #showCommandHelp\n') 427 | expect(ctx.config.showCommandHelpSpy!.getCalls().length).to.equal(1) 428 | expect(ctx.config.showHelpSpy!.getCalls().length).to.equal(0) 429 | const [Command, Topics] = ctx.config.showCommandHelpSpy!.firstCall.args 430 | expect(Command.id).to.deep.equal('test-command-for-help-plugin') 431 | expect(Topics).to.be.an('array') 432 | }) 433 | }) 434 | }) 435 | 436 | describe('.log()', () => { 437 | fancy 438 | .stdout() 439 | .do(async () => { 440 | class CMD extends Command { 441 | async run() { 442 | this.log('json output: %j', {a: 'foobar'}) 443 | } 444 | } 445 | await CMD.run([]) 446 | }) 447 | .do(ctx => expect(ctx.stdout).to.equal('json output: {"a":"foobar"}\n')) 448 | .it('uses util.format()') 449 | }) 450 | 451 | describe('stdout err', () => { 452 | fancy 453 | .stdout() 454 | .do(async () => { 455 | class CMD extends Command { 456 | async run() { 457 | process.stdout.emit('error', new CodeError('dd')) 458 | } 459 | } 460 | await CMD.run([]) 461 | }) 462 | .catch(/dd/) 463 | .it('test stdout error throws') 464 | 465 | fancy 466 | .stdout() 467 | .do(async () => { 468 | class CMD extends Command { 469 | async run() { 470 | process.stdout.emit('error', new CodeError('EPIPE')) 471 | this.log('json output: %j', {a: 'foobar'}) 472 | } 473 | } 474 | await CMD.run([]) 475 | }) 476 | .do(ctx => expect(ctx.stdout).to.equal('json output: {"a":"foobar"}\n')) 477 | .it('test stdout EPIPE swallowed') 478 | }) 479 | }) 480 | -------------------------------------------------------------------------------- /test/helpers/init.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | process.env.TS_NODE_PROJECT = path.resolve('test/tsconfig.json') 3 | -------------------------------------------------------------------------------- /test/helpers/test-help-in-lib/lib/test-help-plugin.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 'use strict'; 3 | Object.defineProperty (exports, '__esModule', {value: true}); 4 | const sinon_1 = require ('sinon'); 5 | class default_1 { 6 | constructor (config, opts) { 7 | this.showCommandHelp = sinon_1.spy (() => { 8 | console.log ('hello from test-help-plugin #showCommandHelp in the lib folder and in compiled javascript'); 9 | }); 10 | this.showHelp = sinon_1.spy (() => { 11 | console.log ('hello showHelp'); 12 | }); 13 | config.showCommandHelpSpy = this.showCommandHelp; 14 | config.showHelpSpy = this.showHelp; 15 | } 16 | command () { 17 | throw new Error ('not needed for testing @oclif/command'); 18 | } 19 | } 20 | exports.default = default_1; 21 | -------------------------------------------------------------------------------- /test/helpers/test-help-in-src/src/test-help-plugin.ts: -------------------------------------------------------------------------------- 1 | import {HelpBase} from '@oclif/help' 2 | import {spy, SinonSpy} from 'sinon' 3 | import {IConfig} from '@oclif/config' 4 | 5 | export type TestHelpClassConfig = IConfig & { showCommandHelpSpy?: SinonSpy; showHelpSpy?: SinonSpy } 6 | 7 | export default class extends HelpBase { 8 | constructor(config: any, opts: any) { 9 | super(config, opts) 10 | config.showCommandHelpSpy = this.showCommandHelp 11 | config.showHelpSpy = this.showHelp 12 | } 13 | 14 | showCommandHelp = spy(() => { 15 | console.log('hello from test-help-plugin #showCommandHelp') 16 | }) 17 | 18 | showHelp = spy(() => { 19 | console.log('hello showHelp') 20 | }) 21 | 22 | getCommandHelpForReadme(): string { 23 | throw new Error('not needed for testing @oclif/command') 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/helpers/test-help-in-src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "rootDir": "./src", 4 | "outDir": "./lib" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/main.test.ts: -------------------------------------------------------------------------------- 1 | import {expect, fancy} from 'fancy-test' 2 | 3 | import {Main} from '../src/main' 4 | import * as OclifHelp from '@oclif/help' 5 | import * as Config from '@oclif/config' 6 | import {TestHelpClassConfig} from './helpers/test-help-in-src/src/test-help-plugin' 7 | 8 | const pjson = require('../package.json') 9 | const version = `@oclif/command/${pjson.version} ${process.platform}-${process.arch} node-${process.version}` 10 | const originalgetHelpClass = OclifHelp.getHelpClass 11 | 12 | describe('main', () => { 13 | fancy 14 | .stdout() 15 | .do(() => Main.run(['plugins'])) 16 | .do(output => expect(output.stdout).to.equal('no plugins installed\n')) 17 | .it('runs plugins') 18 | 19 | fancy 20 | .stdout() 21 | .do(() => Main.run(['-v'])) 22 | .catch('EEXIT: 0') 23 | .do(output => expect(output.stdout).to.equal(version + '\n')) 24 | .it('runs -v') 25 | 26 | fancy 27 | .stdout() 28 | .do(() => Main.run(['-h'])) 29 | .catch('EEXIT: 0') 30 | .do(output => expect(output.stdout).to.equal(`oclif base command 31 | 32 | VERSION 33 | ${version} 34 | 35 | USAGE 36 | $ @oclif/command [COMMAND] 37 | 38 | TOPICS 39 | plugins list installed plugins 40 | 41 | COMMANDS 42 | plugins list installed plugins 43 | 44 | `)) 45 | .it('runs -h') 46 | 47 | describe('with an alternative help class', async () => { 48 | const getMainWithHelpClass = async () => { 49 | const config: TestHelpClassConfig = await Config.load() 50 | config.pjson.oclif.helpClass = './lib/test-help-plugin' 51 | 52 | class MainWithHelpClass extends Main { 53 | config = config 54 | } 55 | 56 | return MainWithHelpClass 57 | } 58 | 59 | fancy 60 | .stdout() 61 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 62 | // @ts-ignore 63 | .stub(OclifHelp, 'getHelpClass', function (config: Config.IConfig) { 64 | const patchedConfig = { 65 | ...config, 66 | root: `${__dirname}/helpers/test-help-in-src/`, 67 | } 68 | 69 | return originalgetHelpClass(patchedConfig) 70 | }) 71 | .do(async () => (await getMainWithHelpClass()).run(['-h'])) 72 | .catch('EEXIT: 0') 73 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 74 | // @ts-ignore 75 | .do(output => expect(output.stdout).to.equal('hello showHelp\n')) 76 | .it('works with -h') 77 | 78 | fancy 79 | .stdout() 80 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 81 | // @ts-ignore 82 | .stub(OclifHelp, 'getHelpClass', function (config: Config.IConfig) { 83 | const patchedConfig = { 84 | ...config, 85 | root: `${__dirname}/helpers/test-help-in-src/`, 86 | } 87 | 88 | return originalgetHelpClass(patchedConfig) 89 | }) 90 | .do(async () => (await getMainWithHelpClass()).run(['--help'])) 91 | .catch('EEXIT: 0') 92 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 93 | // @ts-ignore 94 | .do(output => expect(output.stdout).to.equal('hello showHelp\n')) 95 | .it('works with --help') 96 | 97 | fancy 98 | .stdout() 99 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 100 | // @ts-ignore 101 | .stub(OclifHelp, 'getHelpClass', function (config: Config.IConfig) { 102 | const patchedConfig = { 103 | ...config, 104 | root: `${__dirname}/helpers/test-help-in-src/`, 105 | } 106 | 107 | return originalgetHelpClass(patchedConfig) 108 | }) 109 | .do(async () => (await getMainWithHelpClass()).run(['help'])) 110 | .catch('EEXIT: 0') 111 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore 112 | // @ts-ignore 113 | .do(output => expect(output.stdout).to.equal('hello showHelp\n')) 114 | .it('works with help') 115 | }) 116 | }) 117 | -------------------------------------------------------------------------------- /test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig", 3 | "compilerOptions": { 4 | "sourceMap": true 5 | }, 6 | "include": [ 7 | "./**/*", 8 | "../src/**/*" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "forceConsistentCasingInFileNames": true, 5 | "importHelpers": true, 6 | "module": "commonjs", 7 | "outDir": "./lib", 8 | "pretty": true, 9 | "rootDirs": [ 10 | "./src" 11 | ], 12 | "strict": true, 13 | "target": "es2017" 14 | }, 15 | "include": [ 16 | "./src/**/*" 17 | ] 18 | } 19 | --------------------------------------------------------------------------------