Skip to content

feat(cli): add 'oh plugin enable' and 'oh plugin disable' subcommands - #327

Open
sridhar-3009 wants to merge 1 commit into
HKUDS:mainfrom
sridhar-3009:feat/291-plugin-enable-disable-cli
Open

feat(cli): add 'oh plugin enable' and 'oh plugin disable' subcommands#327
sridhar-3009 wants to merge 1 commit into
HKUDS:mainfrom
sridhar-3009:feat/291-plugin-enable-disable-cli

Conversation

@sridhar-3009

Copy link
Copy Markdown

Summary

Closes #291

The README documents oh plugin enable <name> / oh plugin disable <name> but those subcommands did not exist. After oh plugin install <source> a plugin was registered in settings.enabled_plugins as False, and the only way to flip it was to open the TUI and run /plugin enable foo — which doesn't work for headless (oh -p "..."), CI, Docker, or SSH sessions.

What's added:

oh plugin enable <name>    # sets enabled_plugins[name] = True, saves settings
oh plugin disable <name>   # sets enabled_plugins[name] = False, saves settings

Both commands:

  • Load current settings, validate the plugin name exists (non-zero exit + helpful error if not)
  • Update settings.enabled_plugins exactly as the /plugin slash handler in commands/registry.py does
  • Print "Enabled/Disabled plugin 'X'. Restart session to reload." to match the TUI message

Test plan

  • oh plugin install <path> then oh plugin enable <name> — verify settings.enabled_plugins[name] is True in settings.json
  • oh plugin disable <name> — verify it's set to False
  • oh plugin enable nonexistent — verify non-zero exit and helpful error message
  • oh plugin list — verify enabled/disabled state reflects the change

The README documents 'oh plugin enable <name>' but the CLI had no such
subcommand. After 'oh plugin install <source>' a plugin landed in
settings.enabled_plugins as False and the only way to turn it on was to
launch the TUI and run /plugin enable foo — which blocked headless
(oh -p "..."), CI, Docker, and remote SSH users.

Add two plugin subcommands that mirror the /plugin slash handler in
commands/registry.py:

  oh plugin enable <name>   — set enabled_plugins[name] = True and save
  oh plugin disable <name>  — set enabled_plugins[name] = False and save

Both validate that the plugin key exists in settings.enabled_plugins
(i.e. has been installed) and exit non-zero with a clear message if not.

Fixes HKUDS#291
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: oh plugin enable / disable CLI subcommands

1 participant