Package Exports
- @handy-common-utils/oclif-utils
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@handy-common-utils/oclif-utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@handy-common-utils/oclif-utils
oclif (https://oclif.io/) related utilities
How to use
First add it as a dependency:
npm install @handy-common-utils/oclif-utilsThen you can use it in the code:
import { OclifUtils } from '@handy-common-utils/promise-utils';
protected async init() {
OclifUtils.prependCliToExamples(this);
return super.init();
}You can either import and use the class as shown above, or you can import individual functions directly like below:
import { prependCliToExamples } from '@handy-common-utils/promise-utils';API
@handy-common-utils/oclif-utils
Globals
@handy-common-utils/oclif-utils
Index
Classes
Interfaces
Type aliases
Variables
Functions
Type aliases
CommandArgNames
Ƭ CommandArgNames<T>: T extends { name: infer A }[] ? A : never
Type parameters:
| Name |
|---|
T |
CommandArgs
Ƭ CommandArgs<T>: {}
Type parameters:
| Name | Type |
|---|---|
T |
{ args: Array<{ name: string }> } |
CommandFlags
Ƭ CommandFlags<T>: T extends Parser.Input<*infer* F> ? F : never
Type parameters:
| Name |
|---|
T |
CommandOptions
Ƭ CommandOptions<T>: Parser.Output<CommandFlags<T>, CommandArgs<T>>
Type parameters:
| Name | Type |
|---|---|
T |
{ args: Array<{ name: string }> } |
Variables
generateHelpText
• Const generateHelpText: generateHelpText = OclifUtils.generateHelpText
injectHelpTextIntoReadmeMd
• Const injectHelpTextIntoReadmeMd: injectHelpTextIntoReadmeMd = OclifUtils.injectHelpTextIntoReadmeMd
prependCliToExamples
• Const prependCliToExamples: prependCliToExamples = OclifUtils.prependCliToExamples
Functions
getCommandConfig
▸ getCommandConfig(commandInstance: Command): Command
Parameters:
| Name | Type |
|---|---|
commandInstance |
Command |
Returns: Command
Classes
@handy-common-utils/oclif-utils
Globals / OclifUtils
Class: OclifUtils
Hierarchy
- OclifUtils
Index
Methods
Methods
generateHelpText
▸ Static generateHelpText(commandInstance: Command, opts?: Partial<HelpOptions>): string
Generate formatted text content of help to a command
Parameters:
| Name | Type | Description |
|---|---|---|
commandInstance |
Command | instance of the Command |
opts? |
Partial<HelpOptions> | format options |
Returns: string
help content
getCommandConfig
▸ Static getCommandConfig(commandInstance: Command): Command
Parameters:
| Name | Type |
|---|---|
commandInstance |
Command |
Returns: Command
injectHelpTextIntoReadmeMd
▸ Static injectHelpTextIntoReadmeMd(commandInstance: Command, opts?: Partial<HelpOptions>): Promise<void>
Parameters:
| Name | Type |
|---|---|
commandInstance |
Command |
opts? |
Partial<HelpOptions> |
Returns: Promise<void>
prependCliToExamples
▸ Static prependCliToExamples(commandInstance: Command): void
Use this function to prepend command line to examples.
This function needs to be called from init() function of the Command.
Parameters:
| Name | Type | Description |
|---|---|---|
commandInstance |
Command | instance of the Command |
Returns: void
void
@handy-common-utils/oclif-utils
Globals / SingleCommandHelp
Class: SingleCommandHelp
Hierarchy
Help
↳ SingleCommandHelp
Index
Constructors
Properties
Accessors
Methods
- command
- formatCommand
- formatCommands
- formatRoot
- formatTopic
- formatTopics
- generateHelpText
- showCommandHelp
- showHelp
- showRootHelp
- showTopicHelp
Constructors
constructor
+ new SingleCommandHelp(commandInstance: Command, opts?: Partial<HelpOptions>): SingleCommandHelp
Overrides void
Parameters:
| Name | Type |
|---|---|
commandInstance |
Command |
opts? |
Partial<HelpOptions> |
Returns: SingleCommandHelp
Properties
commandInstance
• Protected commandInstance: Command
config
• Protected config: IConfig
Inherited from SingleCommandHelp.config
opts
• Protected opts: HelpOptions
Inherited from SingleCommandHelp.opts
render
• render: (input: string) => string
Inherited from SingleCommandHelp.render
Accessors
sortedCommands
• Protectedget sortedCommands(): Plugin[]
Inherited from SingleCommandHelp.sortedCommands
Returns: Plugin[]
sortedTopics
• Protectedget sortedTopics(): Topic[]
Inherited from SingleCommandHelp.sortedTopics
Returns: Topic[]
Methods
command
▸ Protectedcommand(command: Command): string
Inherited from SingleCommandHelp.command
deprecated used for readme generation
Parameters:
| Name | Type | Description |
|---|---|---|
command |
Command | The command to generate readme help for |
Returns: string
the readme help string for the given command
formatCommand
▸ ProtectedformatCommand(command: Command): string
Inherited from SingleCommandHelp.formatCommand
Parameters:
| Name | Type |
|---|---|
command |
Command |
Returns: string
formatCommands
▸ ProtectedformatCommands(commands: Command[]): string
Inherited from SingleCommandHelp.formatCommands
Parameters:
| Name | Type |
|---|---|
commands |
Command[] |
Returns: string
formatRoot
▸ ProtectedformatRoot(): string
Inherited from SingleCommandHelp.formatRoot
Returns: string
formatTopic
▸ ProtectedformatTopic(topic: Topic): string
Inherited from SingleCommandHelp.formatTopic
Parameters:
| Name | Type |
|---|---|
topic |
Topic |
Returns: string
formatTopics
▸ ProtectedformatTopics(topics: Topic[]): string
Inherited from SingleCommandHelp.formatTopics
Parameters:
| Name | Type |
|---|---|
topics |
Topic[] |
Returns: string
generateHelpText
▸ generateHelpText(): string
Returns: string
showCommandHelp
▸ showCommandHelp(command: Command): void
Inherited from SingleCommandHelp.showCommandHelp
Overrides void
Parameters:
| Name | Type |
|---|---|
command |
Command |
Returns: void
showHelp
▸ showHelp(argv: string[]): void
Inherited from SingleCommandHelp.showHelp
Overrides void
Parameters:
| Name | Type |
|---|---|
argv |
string[] |
Returns: void
showRootHelp
▸ ProtectedshowRootHelp(): void
Inherited from SingleCommandHelp.showRootHelp
Returns: void
showTopicHelp
▸ ProtectedshowTopicHelp(topic: Topic): void
Inherited from SingleCommandHelp.showTopicHelp
Parameters:
| Name | Type |
|---|---|
topic |
Topic |
Returns: void
Interfaces
@handy-common-utils/oclif-utils
Globals / OclifHelpContent
Interface: OclifHelpContent
Hierarchy
- OclifHelpContent
Index
Properties
Properties
aliases
• Optional aliases: undefined | string
args
• Optional args: undefined | string
description
• Optional description: undefined | string
examples
• Optional examples: undefined | string
flags
• Optional flags: undefined | string
usage
• Optional usage: undefined | string