oclif / oclif/core

Ability to set aliases for sub commands.

Open
#984 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

waiting for interest
Dominant language
TypeScript
Stars
316
Forks
98
Avg merge
12h 32m
Merged PRs (30d)
2

Description

bug

What is the current behavior?

Setting aliases in a command's index file does not propagate to sub-commands.

in ./commands/identity:

export default class Identity extends BaseCommand {
  static override aliases = ['id'];

in the same directory: ./commands/identity/create does not inherit the id alias

export default class Create extends BaseCommand {

Therefore cli id works but cli id create does not.

What is the expected behavior?

It would be convenient to set aliases at the root level.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing alias handling for ./commands/identity and its ./commands/identity/create sub-command, then trace the CLI command-resolution entry point that makes cli id work. The change is complete when the root id alias also resolves cli id create, with tests covering both command forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.