Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@oclif/plugin-commands
Advanced tools
@oclif/plugin-commands is a plugin for the Oclif CLI framework that provides functionality to list and manage commands within an Oclif-based CLI application. It helps developers to easily display available commands, their descriptions, and usage information.
List Commands
This feature allows you to list all available commands in your CLI application. The code sample demonstrates how to use the @oclif/plugin-commands to display a table of commands with their names and descriptions.
const {Command} = require('@oclif/command');
const {cli} = require('cli-ux');
class ListCommands extends Command {
async run() {
const commands = this.config.commands;
cli.table(commands, {
name: {
header: 'Command Name'
},
description: {
header: 'Description'
}
});
}
}
ListCommands.description = 'List all available commands';
module.exports = ListCommands;
Command Help
This feature provides detailed help for a specific command. The code sample shows how to use the @oclif/plugin-commands to display help information for a command named 'mycommand'.
const {Command} = require('@oclif/command');
const {Help} = require('@oclif/plugin-help');
class CommandHelp extends Command {
async run() {
const help = new Help(this.config);
help.showHelp(['mycommand']);
}
}
CommandHelp.description = 'Show help for a specific command';
module.exports = CommandHelp;
Commander is a popular library for building command-line interfaces in Node.js. It provides a simple and flexible way to define commands, options, and arguments. Compared to @oclif/plugin-commands, Commander is more lightweight and does not offer built-in support for listing and managing commands, but it is highly customizable and widely used.
Yargs is another widely-used library for building command-line interfaces in Node.js. It provides a rich set of features for parsing arguments, defining commands, and generating help messages. While Yargs offers similar functionalities to @oclif/plugin-commands, it is more focused on argument parsing and does not provide the same level of integration with the Oclif framework.
Vorpal is a CLI framework that allows developers to build interactive command-line applications. It provides features for defining commands, arguments, and options, as well as support for interactive prompts. Vorpal is similar to @oclif/plugin-commands in terms of command management, but it also includes additional features for creating interactive experiences.
plugin to show the list of all the commands
$ npm install -g @oclif/plugin-commands
$ oclif-example COMMAND
running command...
$ oclif-example (--version)
@oclif/plugin-commands/3.0.1 linux-x64 node-v18.18.0
$ oclif-example --help [COMMAND]
USAGE
$ oclif-example COMMAND
...
oclif-example commands
list all the commands
USAGE
$ oclif-example commands [--json] [-h] [--hidden] [--tree] [--columns <value> | -x] [--filter <value>]
[--no-header | [--csv | --no-truncate]] [--output csv|json|yaml | | ] [--sort <value>]
FLAGS
-h, --help Show CLI help.
-x, --extended show extra columns
--columns=<value> only show provided columns (comma-separated)
--csv output is csv format [alias: --output=csv]
--filter=<value> filter property by partial string matching, ex: name=foo
--hidden show hidden commands
--no-header hide table header from output
--no-truncate do not truncate output to fit screen
--output=<option> output in a more machine friendly format
<options: csv|json|yaml>
--sort=<value> property to sort by (prepend '-' for descending)
--tree show tree of commands
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
list all the commands
See code: src/commands/commands.ts
FAQs
plugin to show the list of all the commands
The npm package @oclif/plugin-commands receives a total of 178,121 weekly downloads. As such, @oclif/plugin-commands popularity was classified as popular.
We found that @oclif/plugin-commands demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.