oclif 2.1.4 โ†’ 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":"2.1.4","commands":{"generate":{"id":"generate","description":"generate a new CLI\nThis will clone the template repo 'oclif/hello-world' and update package properties","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"name","description":"directory name of new project","required":true}]},"manifest":{"id":"manifest","description":"generates plugin manifest json","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"path to plugin","default":"."}]},"promote":{"id":"promote","description":"promote CLI builds to a S3 release channel","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to the oclif CLI project root","required":true,"multiple":false,"default":"."},"version":{"name":"version","type":"option","description":"semantic version of the CLI to promote","required":true,"multiple":false},"sha":{"name":"sha","type":"option","description":"7-digit short git commit SHA of the CLI to promote","required":true,"multiple":false},"channel":{"name":"channel","type":"option","description":"which channel to promote to","required":true,"multiple":false,"default":"stable"},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to promote (e.g.: linux-arm,win32-x64)","multiple":false,"default":"linux-x64,linux-arm,win32-x64,win32-x86,darwin-x64,darwin-arm64"},"deb":{"name":"deb","type":"boolean","char":"d","description":"promote debian artifacts","allowNo":false},"macos":{"name":"macos","type":"boolean","char":"m","description":"promote macOS pkg","allowNo":false},"win":{"name":"win","type":"boolean","char":"w","description":"promote Windows exe","allowNo":false},"max-age":{"name":"max-age","type":"option","char":"a","description":"cache control max-age in seconds","multiple":false,"default":"86400"},"xz":{"name":"xz","type":"boolean","description":"also upload xz","allowNo":true},"indexes":{"name":"indexes","type":"boolean","description":"append the promoted urls into the index files","allowNo":false}},"args":[]},"readme":{"id":"readme","description":"adds commands to README.md in current directory\nThe readme must have any of the following tags inside of it for it to be replaced or else it will do nothing:\n# Usage\n<!-- usage -->\n# Commands\n<!-- commands -->\n\nCustomize the code URL prefix by setting oclif.repositoryPrefix in package.json.\n","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"dir":{"name":"dir","type":"option","description":"output directory for multi docs","required":true,"multiple":false,"default":"docs"},"multi":{"name":"multi","type":"boolean","description":"create a different markdown page for each topic","allowNo":false}},"args":[]},"pack:deb":{"id":"pack:deb","description":"pack CLI into debian package","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."}},"args":[]},"pack:macos":{"id":"pack:macos","description":"pack CLI into macOS .pkg","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"additional-cli":{"name":"additional-cli","type":"option","description":"an Oclif CLI other than the one listed in config.bin that should be made available to the user\nthe CLI should already exist in a directory named after the CLI that is the root of the tarball produced by \"oclif pack:tarballs\"","hidden":true,"multiple":false}},"args":[]},"pack:tarballs":{"id":"pack:tarballs","description":"packages oclif CLI into tarballs\n\nThis can be used to create oclif CLIs that use the system node or that come preloaded with a node binary.\n","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to pack (e.g.: linux-arm,win32-x64)","multiple":false,"default":"linux-x64,linux-arm,win32-x64,win32-x86,darwin-x64,darwin-arm64"},"xz":{"name":"xz","type":"boolean","description":"also build xz","allowNo":true}},"args":[]},"pack:win":{"id":"pack:win","description":"create windows installer from oclif CLI\n\n This command requires WINDOWS_SIGNING (prefixed with the name of your executable, e.g. OCLIF_WINDOWS_SIGNING_PASS) to be set in the environment","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"additional-cli":{"name":"additional-cli","type":"option","description":"an Oclif CLI other than the one listed in config.bin that should be made available to the user\nthe CLI should already exist in a directory named after the CLI that is the root of the tarball produced by \"oclif pack:tarballs\"","hidden":true,"multiple":false}},"args":[]},"upload:deb":{"id":"upload:deb","description":"upload deb package built with pack:deb","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."}},"args":[]},"upload:macos":{"id":"upload:macos","description":"upload macos installers built with pack:macos","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."}},"args":[]},"upload:tarballs":{"id":"upload:tarballs","description":"upload an oclif CLI to S3\n\n\"aws-sdk\" will need to be installed as a devDependency to upload.\n","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to upload (e.g.: linux-arm,win32-x64)","multiple":false,"default":"linux-x64,linux-arm,win32-x64,win32-x86,darwin-x64,darwin-arm64"},"xz":{"name":"xz","type":"boolean","description":"also upload xz","allowNo":true}},"args":[]},"upload:win":{"id":"upload:win","description":"upload windows installers built with pack:win","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."}},"args":[]}}}
1
+ {"version":"2.1.5","commands":{"generate":{"id":"generate","description":"generate a new CLI\nThis will clone the template repo 'oclif/hello-world' and update package properties","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"name","description":"directory name of new project","required":true}]},"manifest":{"id":"manifest","description":"generates plugin manifest json","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"path to plugin","default":"."}]},"promote":{"id":"promote","description":"promote CLI builds to a S3 release channel","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to the oclif CLI project root","required":true,"multiple":false,"default":"."},"version":{"name":"version","type":"option","description":"semantic version of the CLI to promote","required":true,"multiple":false},"sha":{"name":"sha","type":"option","description":"7-digit short git commit SHA of the CLI to promote","required":true,"multiple":false},"channel":{"name":"channel","type":"option","description":"which channel to promote to","required":true,"multiple":false,"default":"stable"},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to promote (e.g.: linux-arm,win32-x64)","multiple":false,"default":"linux-x64,linux-arm,win32-x64,win32-x86,darwin-x64,darwin-arm64"},"deb":{"name":"deb","type":"boolean","char":"d","description":"promote debian artifacts","allowNo":false},"macos":{"name":"macos","type":"boolean","char":"m","description":"promote macOS pkg","allowNo":false},"win":{"name":"win","type":"boolean","char":"w","description":"promote Windows exe","allowNo":false},"max-age":{"name":"max-age","type":"option","char":"a","description":"cache control max-age in seconds","multiple":false,"default":"86400"},"xz":{"name":"xz","type":"boolean","description":"also upload xz","allowNo":true},"indexes":{"name":"indexes","type":"boolean","description":"append the promoted urls into the index files","allowNo":false}},"args":[]},"readme":{"id":"readme","description":"adds commands to README.md in current directory\nThe readme must have any of the following tags inside of it for it to be replaced or else it will do nothing:\n# Usage\n<!-- usage -->\n# Commands\n<!-- commands -->\n\nCustomize the code URL prefix by setting oclif.repositoryPrefix in package.json.\n","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"dir":{"name":"dir","type":"option","description":"output directory for multi docs","required":true,"multiple":false,"default":"docs"},"multi":{"name":"multi","type":"boolean","description":"create a different markdown page for each topic","allowNo":false}},"args":[]},"generate:command":{"id":"generate:command","description":"add a command to an existing CLI or plugin","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","description":"overwrite existing files","allowNo":false}},"args":[{"name":"name","description":"name of command","required":true}]},"generate:hook":{"id":"generate:hook","description":"add a hook to an existing CLI or plugin","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","description":"overwrite existing files","allowNo":false},"event":{"name":"event","type":"option","description":"event to run hook on","multiple":false,"default":"init"}},"args":[{"name":"name","description":"name of hook (snake_case)","required":true}]},"pack:deb":{"id":"pack:deb","description":"pack CLI into debian package","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."}},"args":[]},"pack:macos":{"id":"pack:macos","description":"pack CLI into macOS .pkg","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"additional-cli":{"name":"additional-cli","type":"option","description":"an Oclif CLI other than the one listed in config.bin that should be made available to the user\nthe CLI should already exist in a directory named after the CLI that is the root of the tarball produced by \"oclif pack:tarballs\"","hidden":true,"multiple":false}},"args":[]},"pack:tarballs":{"id":"pack:tarballs","description":"packages oclif CLI into tarballs\n\nThis can be used to create oclif CLIs that use the system node or that come preloaded with a node binary.\n","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to pack (e.g.: linux-arm,win32-x64)","multiple":false,"default":"linux-x64,linux-arm,win32-x64,win32-x86,darwin-x64,darwin-arm64"},"xz":{"name":"xz","type":"boolean","description":"also build xz","allowNo":true}},"args":[]},"pack:win":{"id":"pack:win","description":"create windows installer from oclif CLI\n\n This command requires WINDOWS_SIGNING (prefixed with the name of your executable, e.g. OCLIF_WINDOWS_SIGNING_PASS) to be set in the environment","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"additional-cli":{"name":"additional-cli","type":"option","description":"an Oclif CLI other than the one listed in config.bin that should be made available to the user\nthe CLI should already exist in a directory named after the CLI that is the root of the tarball produced by \"oclif pack:tarballs\"","hidden":true,"multiple":false}},"args":[]},"upload:deb":{"id":"upload:deb","description":"upload deb package built with pack:deb","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."}},"args":[]},"upload:macos":{"id":"upload:macos","description":"upload macos installers built with pack:macos","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."}},"args":[]},"upload:tarballs":{"id":"upload:tarballs","description":"upload an oclif CLI to S3\n\n\"aws-sdk\" will need to be installed as a devDependency to upload.\n","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to upload (e.g.: linux-arm,win32-x64)","multiple":false,"default":"linux-x64,linux-arm,win32-x64,win32-x86,darwin-x64,darwin-arm64"},"xz":{"name":"xz","type":"boolean","description":"also upload xz","allowNo":true}},"args":[]},"upload:win":{"id":"upload:win","description":"upload windows installers built with pack:win","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."}},"args":[]}}}
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [2.1.5](https://github.com/oclif/oclif/compare/v2.1.4...v2.1.5) (2022-01-10)
6
+
5
7
  ### [2.1.4](https://github.com/oclif/oclif/compare/v2.1.3...v2.1.4) (2022-01-10)
6
8
 
7
9
 
package/README.md CHANGED
@@ -5,10 +5,8 @@
5
5
  oclif: Node.JS Open CLI Framework
6
6
  =================================
7
7
 
8
- [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/oclif)
9
8
  [![Version](https://img.shields.io/npm/v/oclif.svg)](https://npmjs.org/package/oclif)
10
9
  [![CircleCI](https://circleci.com/gh/oclif/oclif/tree/main.svg?style=shield)](https://circleci.com/gh/oclif/oclif/tree/main)
11
- [![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/oclif/oclif?branch=main&svg=true)](https://ci.appveyor.com/project/heroku/oclif/branch/main)
12
10
  [![Downloads/week](https://img.shields.io/npm/dw/@oclif/command.svg)](https://npmjs.org/package/@oclif/core)
13
11
  [![License](https://img.shields.io/npm/l/oclif.svg)](https://github.com/oclif/oclif/blob/main/package.json)
14
12
 
@@ -17,6 +15,7 @@ oclif: Node.JS Open CLI Framework
17
15
  * [๐Ÿš€ Getting Started Tutorial](#-getting-started-tutorial)
18
16
  * [โœจ Features](#-features)
19
17
  * [๐Ÿ“Œ Requirements](#-requirements)
18
+ * [๐Ÿ“Œ Migrating from V1](#-migrating-from-v1)
20
19
  * [๐Ÿ— Usage](#-usage)
21
20
  * [๐Ÿ“š Examples](#-examples)
22
21
  * [๐Ÿ”จ Commands](#-commands)
@@ -40,15 +39,14 @@ The [Getting Started tutorial](http://oclif.io/docs/introduction) is a step-by-s
40
39
  * **Flag/Argument parsing** - No CLI framework would be complete without a flag parser. We've built a custom one from years of experimentation that we feel consistently handles user input flexible enough for the user to be able to use the CLI in ways they expect, but without compromising strictness guarantees to the developer.
41
40
  * **Super Speed** - The overhead for running an oclif CLI command is almost nothing. [It requires very few dependencies](https://www.npmjs.com/package/@oclif/command?activeTab=dependencies) (only 35 dependencies in a minimal setupโ€”including all transitive dependencies). Also, only the command to be executed will be required with node. So large CLIs with many commands will load equally as fast as a small one with a single command.
42
41
  * **CLI Generator** - Run a single command to scaffold out a fully functional CLI and get started quickly. See [Usage](#-usage) below.
43
- * **Testing Helpers** - We've put a lot of work into making commands easier to test and mock out stdout/stderr. The generator will automatically create [scaffolded tests](https://github.com/oclif/example-multi-ts/blob/master/test/commands/hello.test.ts).
42
+ * **Testing Helpers** - We've put a lot of work into making commands easier to test and mock out stdout/stderr. The generator will automatically create [scaffolded tests](https://github.com/oclif/hello-world/blob/main/test/commands/hello.test.ts).
44
43
  * **Auto-documentation** - By default you can pass `--help` to the CLI to get help such as flag options and argument information. This information is also automatically placed in the README whenever the npm package of the CLI is published. See the [multi-command CLI example](https://github.com/oclif/example-multi-ts)
45
44
  * **Plugins** - Using [plugins](https://oclif.io/docs/plugins), users of the CLI can extend it with new functionality, a CLI can be split into modular components, and functionality can be shared amongst multiple CLIs. See [Building your own plugin](https://oclif.io/docs/plugins#building-your-own-plugin).
46
45
  * **Hooks** - Use lifecycle hooks to run functionality any time a CLI starts, or on custom triggers. Use this whenever custom functionality needs to be shared between various components of the CLI.
47
- * **TypeScript (or not)** - Everything in the core of oclif is written in TypeScript and the generator can build fully configured TypeScript CLIs or plain JavaScript CLIs. By virtue of static properties in TypeScript the syntax is a bit cleaner in TypeScriptโ€”but everything will work no matter which language you choose. If you use plugins support, the CLI will automatically use `ts-node` to run the plugins enabling you to use TypeScript with minimal-to-no boilerplate needed for any oclif CLI.
46
+ * **TypeScript** - Everything in the core of oclif is written in TypeScript and the generator will build fully configured TypeScript CLIs. If you use plugins support, the CLI will automatically use `ts-node` to run the plugins enabling you to use TypeScript with minimal-to-no boilerplate needed for any oclif CLI.
48
47
  * **Auto-updating Installers** - oclif can package your CLI into [different installers](https://oclif.io/docs/releasing) that will not require the user to already have node installed on the machine. These can be made auto-updatable by using [plugin-update](https://github.com/oclif/plugin-update).
49
48
  * **Everything is Customizable** - Pretty much anything can be swapped out and replaced inside oclif if neededโ€”including the arg/flag parser.
50
49
  * **Autocomplete** - Automatically include autocomplete for your CLI. This includes not only command names and flag names, but flag values as well. For example, it's possible to configure the Heroku CLI to have completions for Heroku app names:
51
- <!--* **Coming soon: man pages** - In addition to in-CLI help through `-help` and the README markdown help generation, the CLI can also automatically create man pages for all of its commands.-->
52
50
 
53
51
  ```
54
52
  $ heroku info --app=<tab><tab> # will complete with all the Heroku apps a user has in their account
@@ -56,7 +54,33 @@ $ heroku info --app=<tab><tab> # will complete with all the Heroku apps a user h
56
54
 
57
55
  # ๐Ÿ“Œ Requirements
58
56
 
59
- Currently, Node 8+ is supported. We support the [LTS versions](https://nodejs.org/en/about/releases) of Node. You can add the [node](https://www.npmjs.com/package/node) package to your CLI to ensure users are running a specific version of Node.
57
+ Currently, Node 12+ is supported. We support the [LTS versions](https://nodejs.org/en/about/releases) of Node. You can add the [node](https://www.npmjs.com/package/node) package to your CLI to ensure users are running a specific version of Node.
58
+
59
+ # ๐Ÿ“Œ Migrating from V1
60
+
61
+ If you have been using version 1 of the [`oclif` CLI](https://github.com/oclif/oclif/tree/v1.18.4) there are some important differences to note when using the latest version.
62
+
63
+ ## Breaking Changes
64
+
65
+ - `oclif multi`, `oclif plugin`, and `oclif single` have all been removed in favor of `oclif generate`, which generates an oclif based CLI using the [hello-world example repo](https://github.com/oclif/hello-world).
66
+ - The reason is that there's not enough of a meaningful difference between a "multi command cli", a "single command cli", and a "plugin" to justify the maintenance cost. The generated CLI can be easily used for any of those use cases.
67
+ - `oclif hook` is now `oclif generate:hook`
68
+ - `oclif command` is now `oclif generate:command`
69
+
70
+ ## New Commands
71
+
72
+ Version 2 now includes all the commands from the [`oclif-dev` CLI](https://github.com/oclif/dev-cli). This means that you can now use a single CLI for all your oclif needs. These commands include:
73
+ - `oclif manifest`
74
+ - `oclif pack`
75
+ - `oclif pack:deb`
76
+ - `oclif pack:macos`
77
+ - `oclif pack:win`
78
+ - `oclif upload` (formerly known as `oclif-dev publish`)
79
+ - `oclif upload:deb` (formerly known as `oclif-dev publish:deb`)
80
+ - `oclif upload:macos` (formerly known as `oclif-dev publish:macos`)
81
+ - `oclif upload:win` (formerly known as `oclif-dev publish:win`)
82
+ - `oclif readme`
83
+
60
84
 
61
85
  # ๐Ÿ— Usage
62
86
 
@@ -82,27 +106,28 @@ hello world from ./src/hello.js!
82
106
 
83
107
  # ๐Ÿ“š Examples
84
108
 
85
- * TypeScript
86
- * [Multi-command CLI](https://github.com/oclif/example-multi-ts)
87
- * [Single-command CLI](https://github.com/oclif/example-single-ts)
88
- * [Multi-command CLI Plugin](https://github.com/oclif/example-plugin-ts)
109
+ * [Hello-World](https://github.com/oclif/hello-world)
110
+ * [Salesforce CLI](https://github.com/salesforcecli/cli)
111
+ * [Heroku CLI](https://github.com/heroku/cli)
89
112
 
90
113
  # ๐Ÿ”จ Commands
91
114
 
92
115
  <!-- commands -->
93
116
  * [`oclif generate NAME`](#oclif-generate-name)
117
+ * [`oclif generate command NAME`](#oclif-generate-command-name)
118
+ * [`oclif generate hook NAME`](#oclif-generate-hook-name)
94
119
  * [`oclif help [COMMAND]`](#oclif-help-command)
95
120
  * [`oclif manifest [PATH]`](#oclif-manifest-path)
96
- * [`oclif pack:deb`](#oclif-packdeb)
97
- * [`oclif pack:macos`](#oclif-packmacos)
98
- * [`oclif pack:tarballs`](#oclif-packtarballs)
99
- * [`oclif pack:win`](#oclif-packwin)
121
+ * [`oclif pack deb`](#oclif-pack-deb)
122
+ * [`oclif pack macos`](#oclif-pack-macos)
123
+ * [`oclif pack tarballs`](#oclif-pack-tarballs)
124
+ * [`oclif pack win`](#oclif-pack-win)
100
125
  * [`oclif promote`](#oclif-promote)
101
126
  * [`oclif readme`](#oclif-readme)
102
- * [`oclif upload:deb`](#oclif-uploaddeb)
103
- * [`oclif upload:macos`](#oclif-uploadmacos)
104
- * [`oclif upload:tarballs`](#oclif-uploadtarballs)
105
- * [`oclif upload:win`](#oclif-uploadwin)
127
+ * [`oclif upload deb`](#oclif-upload-deb)
128
+ * [`oclif upload macos`](#oclif-upload-macos)
129
+ * [`oclif upload tarballs`](#oclif-upload-tarballs)
130
+ * [`oclif upload win`](#oclif-upload-win)
106
131
 
107
132
  ## `oclif generate NAME`
108
133
 
@@ -121,7 +146,44 @@ DESCRIPTION
121
146
  This will clone the template repo 'oclif/hello-world' and update package properties
122
147
  ```
123
148
 
124
- _See code: [src/commands/generate.ts](https://github.com/oclif/oclif/blob/v2.1.3/src/commands/generate.ts)_
149
+ _See code: [src/commands/generate.ts](https://github.com/oclif/oclif/blob/v2.1.4/src/commands/generate.ts)_
150
+
151
+ ## `oclif generate command NAME`
152
+
153
+ add a command to an existing CLI or plugin
154
+
155
+ ```
156
+ USAGE
157
+ $ oclif generate command [NAME] [--force]
158
+
159
+ ARGUMENTS
160
+ NAME name of command
161
+
162
+ FLAGS
163
+ --force overwrite existing files
164
+
165
+ DESCRIPTION
166
+ add a command to an existing CLI or plugin
167
+ ```
168
+
169
+ ## `oclif generate hook NAME`
170
+
171
+ add a hook to an existing CLI or plugin
172
+
173
+ ```
174
+ USAGE
175
+ $ oclif generate hook [NAME] [--force] [--event <value>]
176
+
177
+ ARGUMENTS
178
+ NAME name of hook (snake_case)
179
+
180
+ FLAGS
181
+ --event=<value> [default: init] event to run hook on
182
+ --force overwrite existing files
183
+
184
+ DESCRIPTION
185
+ add a hook to an existing CLI or plugin
186
+ ```
125
187
 
126
188
  ## `oclif help [COMMAND]`
127
189
 
@@ -158,15 +220,15 @@ DESCRIPTION
158
220
  generates plugin manifest json
159
221
  ```
160
222
 
161
- _See code: [src/commands/manifest.ts](https://github.com/oclif/oclif/blob/v2.1.3/src/commands/manifest.ts)_
223
+ _See code: [src/commands/manifest.ts](https://github.com/oclif/oclif/blob/v2.1.4/src/commands/manifest.ts)_
162
224
 
163
- ## `oclif pack:deb`
225
+ ## `oclif pack deb`
164
226
 
165
227
  pack CLI into debian package
166
228
 
167
229
  ```
168
230
  USAGE
169
- $ oclif pack:deb -r <value>
231
+ $ oclif pack deb -r <value>
170
232
 
171
233
  FLAGS
172
234
  -r, --root=<value> (required) [default: .] path to oclif CLI root
@@ -175,15 +237,13 @@ DESCRIPTION
175
237
  pack CLI into debian package
176
238
  ```
177
239
 
178
- _See code: [src/commands/pack/deb.ts](https://github.com/oclif/oclif/blob/v2.1.3/src/commands/pack/deb.ts)_
179
-
180
- ## `oclif pack:macos`
240
+ ## `oclif pack macos`
181
241
 
182
242
  pack CLI into macOS .pkg
183
243
 
184
244
  ```
185
245
  USAGE
186
- $ oclif pack:macos -r <value>
246
+ $ oclif pack macos -r <value>
187
247
 
188
248
  FLAGS
189
249
  -r, --root=<value> (required) [default: .] path to oclif CLI root
@@ -192,15 +252,13 @@ DESCRIPTION
192
252
  pack CLI into macOS .pkg
193
253
  ```
194
254
 
195
- _See code: [src/commands/pack/macos.ts](https://github.com/oclif/oclif/blob/v2.1.3/src/commands/pack/macos.ts)_
196
-
197
- ## `oclif pack:tarballs`
255
+ ## `oclif pack tarballs`
198
256
 
199
257
  packages oclif CLI into tarballs
200
258
 
201
259
  ```
202
260
  USAGE
203
- $ oclif pack:tarballs -r <value> [-t <value>] [--xz]
261
+ $ oclif pack tarballs -r <value> [-t <value>] [--xz]
204
262
 
205
263
  FLAGS
206
264
  -r, --root=<value> (required) [default: .] path to oclif CLI root
@@ -214,15 +272,13 @@ DESCRIPTION
214
272
  This can be used to create oclif CLIs that use the system node or that come preloaded with a node binary.
215
273
  ```
216
274
 
217
- _See code: [src/commands/pack/tarballs.ts](https://github.com/oclif/oclif/blob/v2.1.3/src/commands/pack/tarballs.ts)_
218
-
219
- ## `oclif pack:win`
275
+ ## `oclif pack win`
220
276
 
221
277
  create windows installer from oclif CLI
222
278
 
223
279
  ```
224
280
  USAGE
225
- $ oclif pack:win -r <value>
281
+ $ oclif pack win -r <value>
226
282
 
227
283
  FLAGS
228
284
  -r, --root=<value> (required) [default: .] path to oclif CLI root
@@ -234,8 +290,6 @@ DESCRIPTION
234
290
  be set in the environment
235
291
  ```
236
292
 
237
- _See code: [src/commands/pack/win.ts](https://github.com/oclif/oclif/blob/v2.1.3/src/commands/pack/win.ts)_
238
-
239
293
  ## `oclif promote`
240
294
 
241
295
  promote CLI builds to a S3 release channel
@@ -263,7 +317,7 @@ DESCRIPTION
263
317
  promote CLI builds to a S3 release channel
264
318
  ```
265
319
 
266
- _See code: [src/commands/promote.ts](https://github.com/oclif/oclif/blob/v2.1.3/src/commands/promote.ts)_
320
+ _See code: [src/commands/promote.ts](https://github.com/oclif/oclif/blob/v2.1.4/src/commands/promote.ts)_
267
321
 
268
322
  ## `oclif readme`
269
323
 
@@ -293,15 +347,15 @@ DESCRIPTION
293
347
  Customize the code URL prefix by setting oclif.repositoryPrefix in package.json.
294
348
  ```
295
349
 
296
- _See code: [src/commands/readme.ts](https://github.com/oclif/oclif/blob/v2.1.3/src/commands/readme.ts)_
350
+ _See code: [src/commands/readme.ts](https://github.com/oclif/oclif/blob/v2.1.4/src/commands/readme.ts)_
297
351
 
298
- ## `oclif upload:deb`
352
+ ## `oclif upload deb`
299
353
 
300
354
  upload deb package built with pack:deb
301
355
 
302
356
  ```
303
357
  USAGE
304
- $ oclif upload:deb -r <value>
358
+ $ oclif upload deb -r <value>
305
359
 
306
360
  FLAGS
307
361
  -r, --root=<value> (required) [default: .] path to oclif CLI root
@@ -310,15 +364,13 @@ DESCRIPTION
310
364
  upload deb package built with pack:deb
311
365
  ```
312
366
 
313
- _See code: [src/commands/upload/deb.ts](https://github.com/oclif/oclif/blob/v2.1.3/src/commands/upload/deb.ts)_
314
-
315
- ## `oclif upload:macos`
367
+ ## `oclif upload macos`
316
368
 
317
369
  upload macos installers built with pack:macos
318
370
 
319
371
  ```
320
372
  USAGE
321
- $ oclif upload:macos -r <value>
373
+ $ oclif upload macos -r <value>
322
374
 
323
375
  FLAGS
324
376
  -r, --root=<value> (required) [default: .] path to oclif CLI root
@@ -327,15 +379,13 @@ DESCRIPTION
327
379
  upload macos installers built with pack:macos
328
380
  ```
329
381
 
330
- _See code: [src/commands/upload/macos.ts](https://github.com/oclif/oclif/blob/v2.1.3/src/commands/upload/macos.ts)_
331
-
332
- ## `oclif upload:tarballs`
382
+ ## `oclif upload tarballs`
333
383
 
334
384
  upload an oclif CLI to S3
335
385
 
336
386
  ```
337
387
  USAGE
338
- $ oclif upload:tarballs -r <value> [-t <value>] [--xz]
388
+ $ oclif upload tarballs -r <value> [-t <value>] [--xz]
339
389
 
340
390
  FLAGS
341
391
  -r, --root=<value> (required) [default: .] path to oclif CLI root
@@ -349,15 +399,13 @@ DESCRIPTION
349
399
  "aws-sdk" will need to be installed as a devDependency to upload.
350
400
  ```
351
401
 
352
- _See code: [src/commands/upload/tarballs.ts](https://github.com/oclif/oclif/blob/v2.1.3/src/commands/upload/tarballs.ts)_
353
-
354
- ## `oclif upload:win`
402
+ ## `oclif upload win`
355
403
 
356
404
  upload windows installers built with pack:win
357
405
 
358
406
  ```
359
407
  USAGE
360
- $ oclif upload:win -r <value>
408
+ $ oclif upload win -r <value>
361
409
 
362
410
  FLAGS
363
411
  -r, --root=<value> (required) [default: .] path to oclif CLI root
@@ -365,15 +413,11 @@ FLAGS
365
413
  DESCRIPTION
366
414
  upload windows installers built with pack:win
367
415
  ```
368
-
369
- _See code: [src/commands/upload/win.ts](https://github.com/oclif/oclif/blob/v2.1.3/src/commands/upload/win.ts)_
370
416
  <!-- commandsstop -->
371
417
 
372
418
  # ๐Ÿญ Related Repositories
373
419
 
374
- * [@oclif/command](https://github.com/oclif/command) - Base command for oclif. This can be used directly without the generator.
375
- * [@oclif/config](https://github.com/oclif/config) - Most of the core setup for oclif lives here.
376
- * [@oclif/errors](https://github.com/oclif/errors) - Renders and logs errors from commands.
420
+ * [@oclif/core](https://github.com/oclif/core) - Base library for oclif. This can be used directly without the generator.
377
421
  * [@oclif/cli-ux](https://github.com/oclif/cli-ux) - Library for common CLI UI utilities.
378
422
  * [@oclif/test](https://github.com/oclif/test) - Test helper for oclif.
379
423
 
@@ -384,4 +428,4 @@ _See code: [src/commands/upload/win.ts](https://github.com/oclif/oclif/blob/v2.1
384
428
 
385
429
  # ๐Ÿ“ฃ Feedback
386
430
 
387
- If you have any suggestions or want to let us know what you think of oclif, send us a message at <heroku-cli@salesforce.com>
431
+ If you have any suggestions or want to let us know what you think of oclif, send us a message at <alm-cli@salesforce.com>
package/bin/dev CHANGED
@@ -11,9 +11,8 @@ process.env.NODE_ENV = 'development'
11
11
  require('ts-node').register({project})
12
12
 
13
13
  // In dev mode, always show stack traces
14
- // Waiting for https://github.com/oclif/core/pull/147
15
- // oclif.settings.debug = true;
16
- oclif.settings.disableJsonFlag = true
14
+ oclif.settings.debug = true;
15
+
17
16
 
18
17
  // Start the CLI
19
18
  oclif.run().then(oclif.flush).catch(oclif.Errors.handle)
@@ -0,0 +1,13 @@
1
+ import CommandBase from './../../command-base';
2
+ export default class GenerateCommand extends CommandBase {
3
+ static description: string;
4
+ static flags: {
5
+ force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
+ };
7
+ static args: {
8
+ name: string;
9
+ description: string;
10
+ required: boolean;
11
+ }[];
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_base_1 = require("./../../command-base");
4
+ const core_1 = require("@oclif/core");
5
+ class GenerateCommand extends command_base_1.default {
6
+ async run() {
7
+ const { args, flags } = await this.parse(GenerateCommand);
8
+ await super.generate('command', {
9
+ name: args.name,
10
+ force: flags.force,
11
+ });
12
+ }
13
+ }
14
+ exports.default = GenerateCommand;
15
+ GenerateCommand.description = 'add a command to an existing CLI or plugin';
16
+ GenerateCommand.flags = {
17
+ force: core_1.Flags.boolean({ description: 'overwrite existing files' }),
18
+ };
19
+ GenerateCommand.args = [
20
+ { name: 'name', description: 'name of command', required: true },
21
+ ];
@@ -0,0 +1,14 @@
1
+ import CommandBase from './../../command-base';
2
+ export default class GenerateHook extends CommandBase {
3
+ static description: string;
4
+ static flags: {
5
+ force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
+ event: import("@oclif/core/lib/interfaces").OptionFlag<string>;
7
+ };
8
+ static args: {
9
+ name: string;
10
+ description: string;
11
+ required: boolean;
12
+ }[];
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_base_1 = require("./../../command-base");
4
+ const core_1 = require("@oclif/core");
5
+ class GenerateHook extends command_base_1.default {
6
+ async run() {
7
+ const { args, flags } = await this.parse(GenerateHook);
8
+ await super.generate('hook', {
9
+ name: args.name,
10
+ event: flags.event,
11
+ force: flags.force,
12
+ });
13
+ }
14
+ }
15
+ exports.default = GenerateHook;
16
+ GenerateHook.description = 'add a hook to an existing CLI or plugin';
17
+ GenerateHook.flags = {
18
+ force: core_1.Flags.boolean({ description: 'overwrite existing files' }),
19
+ event: core_1.Flags.string({ description: 'event to run hook on', default: 'init' }),
20
+ };
21
+ GenerateHook.args = [
22
+ { name: 'name', description: 'name of hook (snake_case)', required: true },
23
+ ];
@@ -1,5 +1,5 @@
1
1
  import * as Generator from 'yeoman-generator';
2
- declare class App extends Generator {
2
+ export default class CLI extends Generator {
3
3
  options: {
4
4
  defaults?: boolean;
5
5
  yarn: boolean;
@@ -41,4 +41,3 @@ declare class App extends Generator {
41
41
  end(): void;
42
42
  private _gitignore;
43
43
  }
44
- export = App;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  const child_process_1 = require("child_process");
3
4
  const fs = require("fs");
4
5
  const _ = require("lodash");
@@ -16,7 +17,7 @@ try {
16
17
  hasYarn = true;
17
18
  }
18
19
  catch (_a) { }
19
- class App extends Generator {
20
+ class CLI extends Generator {
20
21
  constructor(args, opts) {
21
22
  super(args, opts);
22
23
  this.name = opts.name;
@@ -28,8 +29,8 @@ class App extends Generator {
28
29
  async prompting() {
29
30
  const msg = 'Time to build an oclif CLI!';
30
31
  this.log(yosay(`${msg} Version: ${version}`));
31
- (0, child_process_1.execSync)(`git clone https://github.com/oclif/hello-world.git ${path.resolve(this.name)}`);
32
- fs.rmdirSync(`${path.resolve(this.name, '.git')}`, { recursive: true });
32
+ (0, child_process_1.execSync)(`git clone https://github.com/oclif/hello-world.git "${path.resolve(this.name)}"`);
33
+ fs.rmSync(`${path.resolve(this.name, '.git')}`, { recursive: true });
33
34
  this.destinationRoot(path.resolve(this.name));
34
35
  process.chdir(this.destinationRoot());
35
36
  this.githubUser = await this.user.github.username().catch(debug);
@@ -37,7 +38,7 @@ class App extends Generator {
37
38
  let repository = this.destinationRoot().split(path.sep).slice(-2).join('/');
38
39
  if (this.githubUser)
39
40
  repository = `${this.githubUser}/${repository.split('/')[1]}`;
40
- const defaults = Object.assign(Object.assign({ name: this.determineAppname().replace(/ /g, '-'), version: '0.0.0', license: 'MIT', author: this.githubUser ? `${this.user.git.name()} @${this.githubUser}` : this.user.git.name(), dependencies: {}, repository }, this.pjson), { engines: Object.assign({ node: '>=8.0.0' }, this.pjson.engines), options: this.options });
41
+ const defaults = Object.assign(Object.assign({ name: this.determineAppname().replace(/ /g, '-'), version: '0.0.0', license: 'MIT', author: this.githubUser ? `${this.user.git.name()} @${this.githubUser}` : this.user.git.name(), dependencies: {}, repository }, this.pjson), { engines: Object.assign({ node: '>=12.0.0' }, this.pjson.engines), options: this.options });
41
42
  this.repository = defaults.repository;
42
43
  if (this.repository && this.repository.url) {
43
44
  this.repository = this.repository.url;
@@ -179,4 +180,4 @@ class App extends Generator {
179
180
  .join('\n') + '\n';
180
181
  }
181
182
  }
182
- module.exports = App;
183
+ exports.default = CLI;
@@ -0,0 +1,10 @@
1
+ import * as Generator from 'yeoman-generator';
2
+ import { GeneratorOptions, PackageJson } from '../types';
3
+ export default class Command extends Generator {
4
+ options: GeneratorOptions;
5
+ pjson: PackageJson;
6
+ constructor(args: string | string[], opts: GeneratorOptions);
7
+ private hasMocha;
8
+ prompting(): Promise<void>;
9
+ writing(): void;
10
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const _ = require("lodash");
4
+ const path = require("path");
5
+ const Generator = require("yeoman-generator");
6
+ const yosay = require("yosay");
7
+ const { version } = require('../../package.json');
8
+ class Command extends Generator {
9
+ constructor(args, opts) {
10
+ super(args, opts);
11
+ this.options = {
12
+ name: opts.name,
13
+ defaults: opts.defaults,
14
+ force: opts.force,
15
+ };
16
+ }
17
+ hasMocha() {
18
+ var _a;
19
+ return Boolean((_a = this.pjson.devDependencies) === null || _a === void 0 ? void 0 : _a.mocha);
20
+ }
21
+ async prompting() {
22
+ this.pjson = this.fs.readJSON('package.json');
23
+ if (!this.pjson)
24
+ throw new Error('not in a project directory');
25
+ this.pjson.oclif = this.pjson.oclif || {};
26
+ this.log(yosay(`Adding a command to ${this.pjson.name} Version: ${version}`));
27
+ }
28
+ writing() {
29
+ const cmdPath = this.options.name.split(':').join('/');
30
+ this.sourceRoot(path.join(__dirname, '../../templates'));
31
+ let bin = this.pjson.oclif.bin || this.pjson.oclif.dirname || this.pjson.name;
32
+ if (bin.includes('/'))
33
+ bin = bin.split('/').pop();
34
+ const cmd = `${bin} ${this.options.name}`;
35
+ const commandPath = this.destinationPath(`src/commands/${cmdPath}.ts`);
36
+ const opts = Object.assign(Object.assign({}, this.options), { bin, cmd, _, type: 'command', path: commandPath });
37
+ this.fs.copyTpl(this.templatePath('src/command.ts.ejs'), commandPath, opts);
38
+ if (this.hasMocha()) {
39
+ this.fs.copyTpl(this.templatePath('test/command.test.ts.ejs'), this.destinationPath(`test/commands/${cmdPath}.test.ts`), opts);
40
+ }
41
+ }
42
+ }
43
+ exports.default = Command;
@@ -0,0 +1,13 @@
1
+ import * as Generator from 'yeoman-generator';
2
+ import { GeneratorOptions, PackageJson } from '../types';
3
+ export interface Options extends GeneratorOptions {
4
+ event: string;
5
+ }
6
+ export default class Hook extends Generator {
7
+ options: Options;
8
+ pjson: PackageJson;
9
+ constructor(args: string | string[], options: Options);
10
+ private hasMocha;
11
+ prompting(): Promise<void>;
12
+ writing(): void;
13
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const _ = require("lodash");
4
+ const path = require("path");
5
+ const Generator = require("yeoman-generator");
6
+ const yosay = require("yosay");
7
+ const { version } = require('../../package.json');
8
+ class Hook extends Generator {
9
+ constructor(args, options) {
10
+ super(args, options);
11
+ this.options = options;
12
+ }
13
+ hasMocha() {
14
+ var _a;
15
+ return Boolean((_a = this.pjson.devDependencies) === null || _a === void 0 ? void 0 : _a.mocha);
16
+ }
17
+ async prompting() {
18
+ this.pjson = this.fs.readJSON('package.json');
19
+ this.pjson.oclif = this.pjson.oclif || {};
20
+ if (!this.pjson)
21
+ throw new Error('not in a project directory');
22
+ this.log(yosay(`Adding a ${this.options.event} hook to ${this.pjson.name} Version: ${version}`));
23
+ }
24
+ writing() {
25
+ this.sourceRoot(path.join(__dirname, '../../templates'));
26
+ this.fs.copyTpl(this.templatePath('src/hook.ts.ejs'), this.destinationPath(`src/hooks/${this.options.event}/${this.options.name}.ts`), this);
27
+ if (this.hasMocha()) {
28
+ this.fs.copyTpl(this.templatePath('test/hook.test.ts.ejs'), this.destinationPath(`test/hooks/${this.options.event}/${this.options.name}.test.ts`), this);
29
+ }
30
+ this.pjson.oclif = this.pjson.oclif || {};
31
+ this.pjson.oclif.hooks = this.pjson.oclif.hooks || {};
32
+ const hooks = this.pjson.oclif.hooks;
33
+ const p = `./src/hooks/${this.options.event}/${this.options.name}`;
34
+ if (hooks[this.options.event]) {
35
+ hooks[this.options.event] = _.castArray(hooks[this.options.event]);
36
+ hooks[this.options.event] = hooks[this.options.event].concat(p);
37
+ }
38
+ else {
39
+ this.pjson.oclif.hooks[this.options.event] = p;
40
+ }
41
+ this.fs.writeJSON(this.destinationPath('./package.json'), this.pjson);
42
+ }
43
+ }
44
+ exports.default = Hook;
@@ -0,0 +1,16 @@
1
+ import * as Generator from 'yeoman-generator';
2
+ export interface PackageJson {
3
+ name: string;
4
+ devDependencies: Record<string, string>;
5
+ dependencies: Record<string, string>;
6
+ oclif: {
7
+ bin: string;
8
+ dirname: string;
9
+ hooks: Record<string, string | string[]>;
10
+ };
11
+ }
12
+ export interface GeneratorOptions extends Generator.GeneratorOptions {
13
+ name: string;
14
+ defaults?: boolean;
15
+ force?: boolean;
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oclif",
3
3
  "description": "oclif: create your own CLI",
4
- "version": "2.1.4",
4
+ "version": "2.1.5",
5
5
  "author": "Salesforce",
6
6
  "bin": {
7
7
  "oclif": "bin/run"
@@ -96,6 +96,7 @@
96
96
  ],
97
97
  "bin": "oclif",
98
98
  "dirname": "oclif",
99
+ "topicSeparator": " ",
99
100
  "macos": {
100
101
  "identifier": "com.oclif.cli",
101
102
  "sign": "Developer ID Installer: Heroku INC"
@@ -0,0 +1,29 @@
1
+ import {Command, Flags} from '@oclif/core'
2
+ <%_ const klass = _.upperFirst(_.camelCase(name)) _%>
3
+
4
+ export default class <%- klass %> extends Command {
5
+ static description = 'describe the command here'
6
+
7
+ static examples = [
8
+ '<%%= config.bin %> <%%= command.id %>',
9
+ ]
10
+
11
+ static flags = {
12
+ // flag with a value (-n, --name=VALUE)
13
+ name: Flags.string({char: 'n', description: 'name to print'}),
14
+ // flag with no value (-f, --force)
15
+ force: Flags.boolean({char: 'f'}),
16
+ }
17
+
18
+ static args = [{name: 'file'}]
19
+
20
+ public async run(): Promise<void> {
21
+ const {args, flags} = await this.parse(<%- klass %>)
22
+
23
+ const name = flags.name ?? 'world'
24
+ this.log(`hello ${name} from <%- path.replace(/\\/g, '\\\\') %>`)
25
+ if (args.file && flags.force) {
26
+ this.log(`you input --force and --file: ${args.file}`)
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,7 @@
1
+ import {Hook} from '@oclif/core'
2
+
3
+ const hook: Hook<'<%- options.event %>'> = async function (opts) {
4
+ process.stdout.write(`example hook running ${opts.id}\n`)
5
+ }
6
+
7
+ export default hook
@@ -0,0 +1,17 @@
1
+ import {expect, test} from '@oclif/test'
2
+
3
+ describe('<%- name %>', () => {
4
+ test
5
+ .stdout()
6
+ .command(['<%- name %>'])
7
+ .it('runs hello', ctx => {
8
+ expect(ctx.stdout).to.contain('hello world')
9
+ })
10
+
11
+ test
12
+ .stdout()
13
+ .command(['<%- name %>', '--name', 'jeff'])
14
+ .it('runs hello --name jeff', ctx => {
15
+ expect(ctx.stdout).to.contain('hello jeff')
16
+ })
17
+ })
@@ -0,0 +1,9 @@
1
+ import {expect, test} from '@oclif/test'
2
+
3
+ describe('hooks', () => {
4
+ test
5
+ .stdout()
6
+ .hook('init', {id: 'mycommand'})
7
+ .do(output => expect(output.stdout).to.contain('example hook running mycommand'))
8
+ .it('shows a message')
9
+ })