summaryrefslogtreecommitdiffstats
path: root/src/error
diff options
context:
space:
mode:
authorDLFW <daniel@llin.info>2024-03-10 20:07:10 +0100
committerGitHub <noreply@github.com>2024-03-10 15:07:10 -0400
commit2de86e369748b5f62e08ea1abb133f9816d60b8b (patch)
tree473787eab309916befb44c220e1aaac6b9905009 /src/error
parentdfbf093611d77e5d95c34f11a496f7f2001273ab (diff)
Add `capture` and `stdout` commands (#495)
This adds two new commands as a base to enable users to use the output of scripts to do certain actions in Joshuto. The first command this adds is a third command to start a sub-process beside `shell` and `spawn`, called `capture`. Like `shell`, `capture` is running blocking but unlike `shell`, it does not release the terminal but captures the `stdout` of the sub-process and stores it in an `AppContext` attribute. The second command added by this commit is `stdout`. This command takes the output from the last `capture` run, stored in the `AppContext` attribute, and uses it for some action. The action has to be specified as a sub-command. As of now, only `stdout cd` is implemented. This checks that the last output of `capture` is a single line of an existing file or directory and then changes the working directory to that. To get significant value from these new commands, `capture` needs to be equipped with more variables to feed more information about Joshuto's state into external scripts, and `stdout` needs to get some more sub-commands.
Diffstat (limited to 'src/error')
-rw-r--r--src/error/error_kind.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/error/error_kind.rs b/src/error/error_kind.rs
index 1d68d29..915244b 100644
--- a/src/error/error_kind.rs
+++ b/src/error/error_kind.rs
@@ -21,11 +21,14 @@ pub enum AppErrorKind {
Regex,
InvalidParameters,
+ StateError,
UnrecognizedArgument,
UnrecognizedCommand,
UnknownError,
+
+ InternalError,
}
impl From<io::ErrorKind> for AppErrorKind {