Socket
Socket
Sign inDemoInstall

@handy-common-utils/oclif-utils

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@handy-common-utils/oclif-utils

oclif related utilities


Version published
Weekly downloads
17
Maintainers
1
Weekly downloads
 
Created
Source

@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-utils

Then 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:
NameType
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:
NameType
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:
NameType
commandInstanceCommand

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:
NameTypeDescription
commandInstanceCommandinstance of the Command
opts?Partial<HelpOptions>format options

Returns: string

help content


getCommandConfig

Static getCommandConfig(commandInstance: Command): Command

Parameters:
NameType
commandInstanceCommand

Returns: Command


injectHelpTextIntoReadmeMd

Static injectHelpTextIntoReadmeMd(commandInstance: Command, opts?: Partial<HelpOptions>): Promise<void>

Parameters:
NameType
commandInstanceCommand
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:
NameTypeDescription
commandInstanceCommandinstance of the Command

Returns: void

void

@handy-common-utils/oclif-utils

Globals / SingleCommandHelp

Class: SingleCommandHelp

Hierarchy
  • Help

    SingleCommandHelp

Index
Constructors
Properties
Accessors
Methods
Constructors
constructor

+ new SingleCommandHelp(commandInstance: Command, opts?: Partial<HelpOptions>): SingleCommandHelp

Overrides void

Parameters:
NameType
commandInstanceCommand
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:
NameTypeDescription
commandCommandThe 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:
NameType
commandCommand

Returns: string


formatCommands

ProtectedformatCommands(commands: Command[]): string

Inherited from SingleCommandHelp.formatCommands

Parameters:
NameType
commandsCommand[]

Returns: string


formatRoot

ProtectedformatRoot(): string

Inherited from SingleCommandHelp.formatRoot

Returns: string


formatTopic

ProtectedformatTopic(topic: Topic): string

Inherited from SingleCommandHelp.formatTopic

Parameters:
NameType
topicTopic

Returns: string


formatTopics

ProtectedformatTopics(topics: Topic[]): string

Inherited from SingleCommandHelp.formatTopics

Parameters:
NameType
topicsTopic[]

Returns: string


generateHelpText

generateHelpText(): string

Returns: string


showCommandHelp

showCommandHelp(command: Command): void

Inherited from SingleCommandHelp.showCommandHelp

Overrides void

Parameters:
NameType
commandCommand

Returns: void


showHelp

showHelp(argv: string[]): void

Inherited from SingleCommandHelp.showHelp

Overrides void

Parameters:
NameType
argvstring[]

Returns: void


showRootHelp

ProtectedshowRootHelp(): void

Inherited from SingleCommandHelp.showRootHelp

Returns: void


showTopicHelp

ProtectedshowTopicHelp(topic: Topic): void

Inherited from SingleCommandHelp.showTopicHelp

Parameters:
NameType
topicTopic

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

Keywords

FAQs

Package last updated on 03 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc