Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a consistent plugin API for signals, interactive shell hooks, etc. #682

Open
andychu opened this issue Mar 30, 2020 · 1 comment

Comments

@andychu
Copy link
Contributor

andychu commented Mar 30, 2020

sh/bash has a number of different styles, and Oil implements many of them:

  • Words:
  • Commands
    • PROMPT_COMMAND -- not a word!
    • The argument to trap (strict_trap_builtin is supposed to restricted this to a function name instead of a code string)
    • compgen -C is an external command
  • Functions
    • command_not_found -- a function invoked interactively, that Debian uses (not implemented in Oil yet)

This is inconsistent, so

Oil should provide Functions instead

  • The default prompt function can evaluate PS1 and return it
  • The default prompt hook can eval $PROMPT_COMMAND
  • ...

Note: sometimes we will need "out params", e.g. completion plugins set COMPREPLY=()

In Oil, this might be setref comp_reply = @(...). Or you can get a legacy -n param and just assign to it.

Use Cases

@andychu
Copy link
Contributor Author

andychu commented Mar 30, 2020

This is a pretty ambitious, long term issue... but I take suggestions / proposals / patches based on real usage.

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

No branches or pull requests

1 participant