Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/commands/which.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import {Command, CliUx} from '@oclif/core'
export default class Which extends Command {
static description = 'Show which plugin a command is in.'
static strict = false;
static examples = [
{
description: 'See which plugin the `help` command is in:',
command: '<%= config.bin %> <%= command.id %> help',
},
]

async run(): Promise<void> {
const {argv} = await this.parse(Which)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this used to be an oclif arg, but we parse argv to support space-separated commands without quotes, see:
#194

Expand All @@ -12,6 +18,8 @@ export default class Which extends Command {
// If this if statement is true then the command to find was passed in as a single string, e.g. `mycli which "my command"`
// So we must use the topicSeparator to split it into an array
command = argv[0].split(this.config.topicSeparator)
} else {
throw new Error('"which" expects a command name. Try something like "which your:command:here" ')
}

const cmd = this.config.findCommand(command.join(':'), {must: true})
Expand Down