Git Product home page Git Product logo

plugin-help's Introduction

@oclif/plugin-help

A CLI command to invoke the standard help functionality from oclif/core.

Version Downloads/week License

oclif help [COMMAND]

Display help for oclif.

USAGE
  $ oclif help [COMMAND...] [-n]

ARGUMENTS
  COMMAND...  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for oclif.

See code: src/commands/help.ts

Contributing

See contributing guide

plugin-help's People

Contributors

amphro avatar chadian avatar danhulton avatar dependabot[bot] avatar dobesv avatar g-rath avatar greenkeeper[bot] avatar iowillhoit avatar jdx avatar junkern avatar lzhang avatar mdonnalley avatar mshanemc avatar oclif-bot avatar peternhale avatar rasphilco avatar rbergman avatar rodesp avatar shetzel avatar skriptach avatar svc-cli-bot avatar tomalec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

plugin-help's Issues

Customized help output for command flags

All of our commands inherit from a common base command that introduce two standard flags. It is possible for plugins to duplicate these flags (particularly, dynamically generated commands based on an Open API spec). Since they are global flags (and advanced usage patterns), we'd like to limit them to utilize single-character short form only and either hide the long form from help output or disallow it entirely. The other option is to use a more verbose name, but we don't like the UX of that either.

PR and some comments here: oclif/parser#47

Feedback provided that this is not a good UX pattern on its own and a more powerful alternative is to support help overrides/templates that would allow for customizing flag help output.

This would support our needs.

The new `npm-shrinkwrap.json` file contains unnecessary dependencies

Describe the bug
npm install @oclif/plugin-help@^6.0.17 installs 1294 dependencies WHEREAS @oclif/plugin-help@<=6.0.16 only installs 91 dependencies.
I have compared this repo's code between those two versions (6.0.16...6.0.17) and the code is not importing nor depending on any additional dependencies.
The bug is that too many packages are being installed and the package do not appear to be needed.

To Reproduce

  1. Create an empty node project using npm init --yes and install @oclif/plugin-help
  2. npm install @oclif/plugin-help@^6.0.17

Expected behavior
@oclif/plugin-help should only need 91 dependencies.
Perhaps the npm-shrinkwrap.json file needs to be cleaned up. Perhaps the npm-shrinkwrap.json file contains devDependencies that should not be in it?

Environment (please complete the following information):

  • OS & version: MacOS Sonoma 14.2.1
  • Shell/terminal: zsh 5.9 (x86_64-apple-darwin23.0)
  • Node: v20.11.1

Additional context
Add any other context about the problem here.

HelpClass is not a constructor

My project that uses plugin-help, I get the error TypeError: HelpClass is not a constructor with running with --help or oclif-dev readme I've updated all of my dependencies to the latest versions and still see it.

I've searched and not had much luck finding known issues or solutions.

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 10.10.0 to 10.10.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… ci/circleci: node-latest: Your tests passed on CircleCI! (Details).
  • βœ… ci/circleci: node-8: Your tests passed on CircleCI! (Details).
  • βœ… continuous-integration/appveyor/branch: AppVeyor build succeeded (Details).
  • βœ… codecov/project: No report found to compare against (Details).
  • βœ… codecov/patch: Coverage not affected. (Details).
  • ❌ Build: We could not find a valid build file. Please ensure that your repo contains a cloudbuild or a Dockerfile.

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

How to create custom help extending the Help class?

Using TS, how should I import the Help class from '@oclif/plugin-help'?

I already configure oclif.helpClass key to package.json:

{
 "oclif": {
    "helpClass": "./dist/custom-help",
  }
}

And I've tried to import it in two different ways:

image

image

Help is not shown on subcommands

In a cli with subcommands, the help doesn't always work.

➜  cli git:(ux/remove-aliases) βœ— ./bin/run account 
Manage your MESG Accounts

USAGE
  $ mesg-cli account:COMMAND

COMMANDS
  account:create              Create a new account
  account:delete              Delete an existing account
  account:export              Export an existing account
  account:import              Import a account
  account:import-private-key  Import a account from a private key
  account:list                List all existing accounts
➜  cli git:(ux/remove-aliases) βœ— ./bin/run account:
 β€Ί   Error: command account: not found

./bin/run account: should return the same help message

Documentation?

Sorry if I'm being stupid; the docs site (https://oclif.io) links to the github repo, which also contains no docs on what this does / how it works. Am I missing something?

Show required flags first

Requesting an option to list flags that are required first above optional flags, and possibly visually separate them with a break and/or separate heading.

Hiding the Help Values

Hi Guys

I wanted to find out if there is a way to remove the helpValue or at least keep it hidden. So currently it has the following format:

describe the command here

USAGE
  $ wallhaven-downloader

OPTIONS
  -a, --atleast=atleast                                              Atleast - Minimum allowed resolution
  -c, --category=category                                            Category - Field used to specify the category type for the search
  -o, --order=desc|asc                                               [default: desc] Order - Order of the search results
  -p, --purity=purity                                                Search Purity - Field used to control the purity of the search
  -q, --query=query                                                  Search Query - Field used to search for wallpapers
  -r, --resolutions=resolutions                                      Resolution - A list or single resolution for the wallpapers
  -s, --sorting=date_added|relevance|random|views|favorites|toplist  [default: date_added] Sorting - Field used to sort wallhaven's results
  -v, --version                                                      Version - Current version of @gregsithole/wallhaven-downloader

But what I want is:

describe the command here

USAGE
  $ wallhaven-downloader

OPTIONS
  -a, --atleast                                             Atleast - Minimum allowed resolution
  -c, --category                                            Category - Field used to specify the category type for the search
  -o, --order                                              [default: desc] Order - Order of the search results
  -p, --purity                                                Search Purity - Field used to control the purity of the search
  -q, --query                                                  Search Query - Field used to search for wallpapers
  -r, --resolutions                                      Resolution - A list or single resolution for the wallpapers
  -s, --sorting Sorting - Field used to sort wallhaven's results
  -v, --version                                                      Version - Current version of @gregsithole/wallhaven-downloader

Installing @oclif/plugin-help gives 5 moderate vulnerabilities and npm audit fix breaks it.

Can't get rid of vulnerabilities because npm audit fix breaks the plugin.

/project/node_modules/cli-ux/lib/styled/table.js:285
        columns: command_1.flags.string({ exclusive: ['extended'], description: 'only show provided columns (comma-separated)' }),
                                 ^

TypeError: Cannot read properties of undefined (reading 'string')
    at /project/node_modules/cli-ux/lib/styled/table.js:285:34

How is the --all option designed to be used?

I can't seem to figure out how to use the --all option such that when a user types in "help" from the root it shows all of the commands (root and topic commands), not just the root commands.

I've tried

czctl help --all
czctl --help --all
czctl -h --all
czctl --all

My solution right now is to provide my own Help class that extends this plugin, and do

constructor(config: Config.IConfig, opts?: Partial<HelpOptions>) {
        opts = { ...opts, all: true }
        super(config, opts)
}

Could an example be provided? Much appreciated.

Include command aliases in commands list

Command alias are only displayed when requesting help for the actual command (or the alias). It would be helpful if command aliases showed in the list of commands like other commands do.

Update vulnerable wrap-ansi dependency

One of the packages: wrap-ansi (3.0.0 - 6.1.0) depends on vulnerable versions of string-width and strip-ansi. Please merge PR, update dev depdencies, and do a release.

Subclassing `Help` in a JavaScript project throws errors

Steps to reproduce:

  1. Create a new JavaScript project
    $ npx oclif multi test-command
  2. Create test-command/src/help.js
     const { Help } = require('@oclif/plugin-help');
     
     module.exports = class TestHelp extends Help {
       showHelp(args) {
         console.log('Hello, world! I am customized help!');
         super.showHelp(args);
       }
     };
  3. Add oclif.helpClass key to package.json:
    {
      "oclif": {
        "helpClass": "./src/help"
      }
    }
  4. Run command:
    $ node bin/run
    Error: Unable to load configured help class "./src/help", failed with message:
    Class extends value undefined is not a constructor or null
        at Object.getHelpClass (~/workspace/test-command/node_modules/@oclif/plugin-help/lib/util.js:66:19)
        at Main._help (~/workspace/test-command/node_modules/@oclif/command/lib/main.js:40:41)
        at Main.init (~/workspace/test-command/node_modules/@oclif/command/lib/command.js:81:25)
        at Main.init (~/workspace/test-command/node_modules/@oclif/command/lib/main.js:12:22)
        at async Main._run (~/workspace/test-command/node_modules/@oclif/command/lib/command.js:42:13)

The documentation currently only shows extending HelpBase in JavaScript projects, although the second example appears to be showing an example which would be extending Help. If I change my example to extend HelpBase, it fails in a different yet predictable fashion:

$ node bin/run
Hello, world! I am customized help!
TypeError: (intermediate value).showHelp is not a function
    at TestHelp.showHelp (~/workspace/test-command/src/help.js:6:11)
    at Main._help (~/workspace/test-command/node_modules/@oclif/command/lib/main.js:42:14)
    at Main.init (~/workspace/test-command/node_modules/@oclif/command/lib/command.js:81:25)
    at Main.init (~/workspace/test-command/node_modules/@oclif/command/lib/main.js:12:22)
    at async Main._run (~/workspace/test-command/node_modules/@oclif/command/lib/command.js:42:13)

Help is super slow in v3

With "@oclif/plugin-help": "^2.2.3",:

➜ time twilio
unleash the power of Twilio from your command prompt

VERSION
  twilio-cli/2.4.0 darwin-x64 node-v10.21.0

USAGE
  $ twilio [COMMAND]

COMMANDS
  api            advanced access to all of the Twilio APIs
  autocomplete   display autocomplete installation instructions
  debugger       Show a list of log events generated for the account
  email          sends emails to single or multiple recipients using Twilio SendGrid
  feedback       provide feedback to the CLI team
  help           display help for twilio
  login          create a new profile to store Twilio Account credentials and configuration
  phone-numbers  manage Twilio phone numbers
  plugins        list available plugins for installation
  profiles       manage credentials for Twilio profiles
  rtc            A plugin which showcases real-time communication applications powered by Twilio

twilio  0.70s user 0.16s system 114% cpu 0.756 total

With "@oclif/plugin-help": "^3.1.0",:

➜ time twilio
unleash the power of Twilio from your command prompt

VERSION
  twilio-cli/2.4.0 darwin-x64 node-v10.21.0

USAGE
  $ twilio [COMMAND]

TOPICS
  api            advanced access to all of the Twilio APIs
  debugger       Show a list of log events generated for the account
  email          sends emails to single or multiple recipients using Twilio SendGrid
  feedback       provide feedback to the CLI team
  phone-numbers  manage Twilio phone numbers
  plugins        list available plugins for installation
  profiles       manage credentials for Twilio profiles
  rtc            A plugin which showcases real-time communication applications powered by Twilio

COMMANDS
  autocomplete  display autocomplete installation instructions
  feedback      provide feedback to the CLI team
  help          display help for twilio
  login         create a new profile to store Twilio Account credentials and configuration
  plugins       list installed plugins

twilio  22.67s user 0.41s system 97% cpu 23.638 total

Can I hide the "TOPICS" section in help?

Can I hide the "TOPICS" section in help?

I read all the documentation and tried to do this in several ways:

Editing "ocif.topics" in package.json.

Setting "hidden = true" in commands.

help only shows flags for base command

I am following the shared abstract command pattern to share a flag declaration across multiple commands. See https://oclif.io/docs/base_class

What I find, though, is that help will show the extended command class information, but not its flags. It will only show the base class flags. I expect help should show all the flags for the command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.