feature:hook:remove

Introduction

feature:hook:remove removes a template hook from an editable feature. It deletes the register_template_hook call from hooks.py and the slot from the feature’s contract. The callback stays unless you ask for it to go.

splent feature:hook:remove splent_feature_notes layout.sidebar
Remove hook registration for slot 'layout.sidebar' from splent_feature_notes? [y/N]: y
✅ Hook registration 'layout.sidebar' removed from hooks.py.
✅ Contract updated in pyproject.toml.

Removing the callback too

splent feature:hook:remove splent_feature_notes layout.sidebar --with-function

The function goes with its decorators. It is kept, with a warning, when hooks.py still uses it elsewhere, for example for another slot.

⚠  Function 'render_notes_sidebar()' kept: it is still used elsewhere in hooks.py.

Skipping the prompt

splent feature:hook:remove splent_feature_notes layout.sidebar --with-function -y

Reference

Arguments and options

Argument or option Description
FEATURE_REF An editable feature, splent_feature_notes or splent-io/splent_feature_notes
SLOT The hook slot to remove
--with-function Also remove the callback’s definition
-y, --yes Skip the confirmation prompt

Only [tool.splent.contract.provides].hooks changes in pyproject.toml. [tool.splent.contract.extensible].hooks, comments and multi-line arrays stay as they were.

Errors

Message What to do
Hook slot '<slot>' not found in hooks.py. Run feature:hooks to see the registered slots
Editable feature not found: <name> Create the feature, or run feature:unlock on a pinned one
feature:hook:remove only works on editable features. Drop the @version suffix

Requirements

  • A selected product (SPLENT_APP).
  • An editable feature, at the workspace root or in .splent_cache/features/<namespace>/<feature_name>/.

See also


Back to top

splent. Distributed by an LGPL license v3. Contact us: drorganvidez@us.es