Skip to content

Expose function lookup/dispatch API for embedded hosts #16

Closed

Description

@caomengxuan666

Winuxsh is moving interactive startup to a primary ~/.winuxshrc entry point and an Oh-My-style framework. The framework registers lifecycle hook runners such as winuxsh_run_precmd_hooks, winuxsh_run_preexec_hooks, and winuxsh_run_chpwd_hooks as shell functions.

Today the Winuxsh host can source rc/framework code into the embedded rubash Executor, but there is no clean host-side API to ask whether a shell function exists or to invoke a function with temporary environment/context. The current workaround is to execute shell text such as:

winuxsh_run_precmd_hooks 2>/dev/null || true

That works, but it is not an ideal embedded-host contract: it hides missing functions as generic command-not-found behavior, may perform normal command lookup, and makes lifecycle integration harder to reason about.

Requested API shape, exact names flexible:

  • query whether a function is defined in the current Executor state;
  • invoke a named shell function without external PATH lookup;
  • pass temporary env/context for the call and restore it afterwards, or at least document the recommended host pattern;
  • preserve normal rubash exit-status semantics for the function body.

This would let Winuxsh call framework lifecycle hooks directly while keeping plugin/framework behavior out of Winuxsh core and avoiding brittle shell-string probes.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions