Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

Implement a which built-in #68

Merged
merged 4 commits into from
Mar 29, 2024
Merged

Conversation

AtkinsSJ
Copy link
Contributor

image

which lets you query which executable will be run for a given command. This is not yet especially useful, because everything is either a built-in or a script file, but we should have PathCommandProvider working soon. :^)

We sometimes want to look-up a command without actually executing it, so
the parsing is unnecessary work.
lookupAll() takes the same arguments as lookup(), but returns either
undefined or an array of matching commands. Our existing
CommandProviders will only ever produce a single result, but this will
not be the case for reading executables from PATH.
CommandProviders can expose this by setting the 'path' field of the
object they return from execute(). If 'path' is not set, we assume that
the command is a shell built-in.

Scripts set their 'path' to be the same as the path used to access them,
which matches the behaviour I'm seeing on Linux.
@KernelDeimos
Copy link
Collaborator

a bit of merge backlog due to upcoming backend release 😅 - this one is pretty straightforward, merging it

@KernelDeimos KernelDeimos merged commit ba67149 into HeyPuter:trunk Mar 29, 2024
3 checks passed
@AtkinsSJ AtkinsSJ deleted the which-builtin branch March 29, 2024 22:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants