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

allow user control over "first word lookup" / generalization of $PATH #588

Open
andychu opened this issue Jan 24, 2020 · 6 comments
Open

Comments

@andychu
Copy link
Contributor

andychu commented Jan 24, 2020

#587 made me think: can we look up our internal readlink LAST? (What about realpath too?)

Right now there is a hard-coded POSIX lookup order:

  • keywords (although these are syntactically different)
  • special builtins (can't be overridden by functions)
  • functions
  • builtins
  • external processes (ls, etc)

And aliases are in there somewhere. I guess you can have aliases for keywords, so they're really first?

I think I floated an idea like

setvar METAPATH = @(special-builtins procs builtins PATH oil-polyfill)

PATH signifies a bunch of lookups.

Or maybe they should be separated without : so you don't have to parse it.

It could be something like:

setvar METAPATH = @(procs @split($PATH, %colon)  ) 

This affects Oil Blocks and the Config Dialect, because blocks will have custom "builtins" tacked onto the end. They temporarily change the lookup order.

For example the opts block in #469 will have arg and flag "builtins"

@andychu
Copy link
Contributor Author

andychu commented Mar 31, 2020

Possible simpler solution:

We could make a special category so that builtin sleep and builtin readlink work, but sleep and readlink are the external binaries.

But I think that's too confusing and subtle...

@andychu
Copy link
Contributor Author

andychu commented Apr 19, 2020

Idea:

  • bin/osh by default doesn't have new builtins
  • when shopt --set oil:basic, the "METAPATH" (or whatever mechanism we choose) gets slurp, getline, json, push, etc.
    • although I think repr is useful enough to be there by default ...

@andychu
Copy link
Contributor Author

andychu commented Oct 3, 2020

Related: command_not_found hook in bash, which we don't have.

Someone brought that up

@andychu andychu mentioned this issue Feb 3, 2021
1 task
@andychu
Copy link
Contributor Author

andychu commented May 21, 2021

#453 for use bin and use dialect is now very related

@andychu
Copy link
Contributor Author

andychu commented Oct 30, 2023

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