Skip to content

Conversation

@mdonnalley
Copy link
Contributor

@mdonnalley mdonnalley commented Jul 31, 2025

Allow CLIs to have an executable root command (instead of just showing help output). Behavior is opt-in so existing CLIs should be unaffected

TODO: Submit PR to update documentation for command discovery strategies once this is merged

Before:

$ my-cli => shows help output

After

$ my-cli => executes command logic

Usage

In the oclif section of your package.json

    "commands": {
      "strategy": "pattern",
      "includeRoot": true,
      "target": "./lib/commands"
    },

The includeRoot property tells oclif to use the Command class found in lib/commands/index.js

@mdonnalley mdonnalley force-pushed the mdonnalley/root-cmd-cli branch from 8482f8a to a1c5b01 Compare July 31, 2025 21:54
@mdonnalley mdonnalley added the waiting for interest Waiting to see if there's strong community interest label Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting for interest Waiting to see if there's strong community interest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants