Introduce "binary" scripts for all native commands #116
No reviewers
Labels
No Label
bug
code-quality
documentation
duplicate
enhancement
feature
flair
invalid
on-hold
release
third-party bug
tooling
wontfix
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: tools/josh#116
Loading…
Reference in New Issue
No description provided.
Delete Branch "binaries"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #114.
All "native" commands such as
cd
andmkdir
are now stored as files in/bin
. When a user invokes a command, josh will look for it in/bin
,eval
the contents of the appropriate file, and execute it. Similarly, thehelp
command now dynamically finds the documentation of a command. Users can now also write their own commands, and if those are stored in directories other than/bin
, the user must give a (relative or absolute) path instead of just a word. Either way, josh uses the newresolve
function inCommands
.Commands have access to
input
andstreams
as before, but now also have a number of additional variables loaded into their namespace. This is done in the privateinterpretScript
method inCommands
. Variables include classes that should be available to commands, but also the importantjosh
variable. This variable essentially contains the API for interacting with the shell.josh
has references to the file system, environment, user list, and also has a number of useful utilities. This API can be extended easily if necessary.All basic commands are now stored as strings in
Commands.ts
. This means that the IDE does not give suggestions or highlight errors. Also note that they are written in JavaScript instead of TypeScript. Because of these limitations, the commands have (finally) been tested extensively where possible. Some commands, such asopen
andpoweroff
have not been tested because they would require some sort of dependency injection, which is not suitable for this PR.