summaryrefslogtreecommitdiff
path: root/Shell/Shell.cpp
AgeCommit message (Collapse)Author
2020-08-07Shell: Make Command::redirections a NonnullRefPtrVectorAndreas Kling
2020-08-06Shell: Print job status after suspending a commandAndreas Kling
2020-08-06Shell: Remove unnecessary ignore() in Shell::custom_event()Andreas Kling
Ignoring an event means that it will bubble to the parent Core::Object. This is not necessary here.
2020-08-06Shell: Make Job constructors private and use a create() helperAndreas Kling
Also store PGIDs as pid_t since that's what they are.
2020-08-06Shell: Make run_command() return a NonnullRefPtrVector<Job>Andreas Kling
This never returns null Job pointers.
2020-08-05Shell: Do not assume that stdin/stdout is a TTYAnotherTest
This closes #2989.
2020-08-04Shell: Give the TTY to the foreground processAnotherTest
This fixes the bug with the shell not waiting for any foreground process that attempts to read from the terminal in the Lagom build.
2020-08-04Shell: Correct FdRedirection inheriting from two RefCounted basesAnotherTest
Also add missing calls to `adopt()`.
2020-08-04Shell: factor out updating the path cache into a function.Mathieu PATUREL
2020-08-04Shell: update cached_path when adding aliasesMathieu PATUREL
This has the nice side effect of fixing alias completion, because cached_path is the source of truth for the completion system, and it was only refreshed (with shell::cache_path()) in the shell's constructor, before the rc files where loaded (ie no aliases) This also means that shell::is_runnable can now rely on the cache, and doesn't have to check the aliases itself.
2020-08-04Shell: highlight runnable commandsMathieu PATUREL
And display in red the command which will result in something like "no command, or is directory" (inspired by the fish shell).
2020-07-26Refactor: Change the AK::binary_search signature to use AK::Span.asynts
2020-07-16Shell: Add a 'for' loopAnotherTest
Closes #2760. This commit adds a 'for' loop, and tweaks the syntax slightly to make && bind more tightly than || (allowing for `expr && if_ok || if_bad`) :^)
2020-07-16Shell: Parse lists serially, and flatten them only when neededAnotherTest
This allows `((1 2 3) (4 5 6))` to remain nested until we explicitly flatten it out.
2020-07-15Shell: Explicitly declare 'environ' to make the macOS Lagom build happyAnotherTest
2020-07-13Shell: Avoid waiting for jobs that were *just* unblockedAnotherTest
This fixes the issue with C-z not suspending the job on the first try. ...and further signal issues when the suspended job is contiued.
2020-07-13Shell: Put children in their own process groups and fix job controlAnotherTest
This commit fixes job control by putting children in their own process group, and proxying TTY signals to active jobs. This also cleans up the code around builtin_disown a bit to use the newer job interfaces.
2020-07-13Shell: Move out run_commands and expand_aliases to be Shell member fnsAnotherTest
This makes running commands from outside the AST chain easier.
2020-07-09Shell: Handle signals asynchronouslyTom
Fixes #2717
2020-07-07Shell: Suggest aliases when completing program names :^)AnotherTest
Closes #2732
2020-07-06Shell: Keep the TTY on the same pgroup to get tty signalsAnotherTest
This allows the shell to be notified about SIGWINCH even when a child process is running in the foreground.
2020-07-06Shell: Do not treat the ending newline as part of a commentAnotherTest
This allows the parser to finally parse the entire source into a single AST. As a result of allowing comments inside sequences, Sequence is also marked as would_execute if its left or right node would.
2020-07-06Shell: Do not treat the absence of an init script as an errorAnotherTest
2020-07-05Shell: Do not remove more than 2 dashes from the option being completedAnotherTest
This makes '------inl' a completion request for an option named '----inl' instead of 'inl'.
2020-07-05Shell: Initial support for 'option' completionsAnotherTest
Take one small step towards #2357. Handle completing barewords starting with '-' by piping the requests to the Shell::complete_option(program_name, option) :^) Also implements completion for a single builtin (setopt) until we figure out how to handle #2357.
2020-07-05Shell: Add a 'setopt' builtinAnotherTest
This builtin sets (and unsets) boolean flags that alter the behaviour of the shell. The only flags added are - inline_exec_keep_empty_segments: Keep empty segments in the result of splitting $(...) by $IFS - verbose: Announce each command before executing it It should be noted that the (rather extreme) verbosity of the names is intentional, and will hopefully be alleviated by the next commit :^)
2020-07-05Shell: Show descriptions about syntax errorsAnotherTest
The description contains an error message and where in the source the error happened.
2020-07-05Shell: Allow a command sequence to be delimited by newlinesAnotherTest
2020-07-05Shell: Build as part of Lagom as wellAnotherTest
Bringing the Serenity Shell to your very own host system :^)
2020-07-05Shell: Provide completions to Tilde and its Juxtaposition.AnotherTest
This commit also removes the ExecutionInputType and directly uses RefPtr<Shell> instead, since nothing else is needed for execution purposes, and also makes the shell refuse to evaluate commands with any sort of syntax error.
2020-07-05Shell: Allow commands in variables, and properly substitute them on useAnotherTest
This allows the below interaction to work: ``` $ silence=(2>&1 >/dev/null) $ do_noisy_thing with these args $silence <nothing here lol> ```
2020-07-05Shell: Expand Juxtaposition of lists to list productsAnotherTest
This commit makes `echo x(foo bar)` create an argv of `echo xfoo xbar`, essentially modeling brace expansions in some shells.
2020-07-05Shell: Read and evaluate an init file on startAnotherTest
This behaviour is overridable with the `--skip-init' flag. The default file is at '~/shell-init.sh'
2020-07-05Shell: Add the alias builtin and resolve aliasesAnotherTest
This follows the other shells in alias resolution, and resolves the alias only once.
2020-07-05Shell: Switch to a new parser and ASTAnotherTest
This commit also completely reworks the execution, highlighting and completion model to work with the new AST. New additions: - $(...) stdout captures - fd>&fd redirections - fd>&- redirections (close fd) - read-write redirections (<> path) - completely event-based execution - the weird idea of allowing the user to redirect the shell's own fds - variables in strings - local variables - minimal list support - adding hyperlinks to all paths that exist
2020-06-27LibLine: Support multiline editingAnotherTest
This commit also updates Shell, which uses actual_rendered_length.
2020-06-17Meta: Scale back overly informal user-facing stringsAndreas Kling
We were getting a little overly memey in some places, so let's scale things back to business-casual. Informal language is fine in comments, commits and debug logs, but let's keep the runtime nice and presentable. :^)
2020-06-12AK: Make string-to-number conversion helpers return OptionalAndreas Kling
Get rid of the weird old signature: - int StringType::to_int(bool& ok) const And replace it with sensible new signature: - Optional<int> StringType::to_int() const
2020-06-08Shell: Highlight redirectionsAnotherTest
2020-05-30Shell: Treat ^D as builtin_exit when not in a continuationAnotherTest
2020-05-30Shell: Correctly complete paths in redirectionsAnotherTest
This commit allows the Shell to complete paths in redirections. A closing quote is added if the path is an unclosed quote. ``` $ foo > "foob<tab> $ foo > "foobar" ```
2020-05-27Shell: Save the history when quitting via the exit builtinAnotherTest
2020-05-27Shell: Never assign equal job ids to two different jobsAnotherTest
Since the last job need not have an ID of size()-1, we need to find the max job id and give that+1 out
2020-05-27Shell: Provide some information to inspectorsAnotherTest
2020-05-27Shell: Avoid messing with sigaction while waiting for a childAnotherTest
2020-05-27LibLine: Use Core::EventLoop for outer read loopAnotherTest
This commit changes LibLine's internal structure to work in an event loop, and as a result, also switches it to being a Core::Object.
2020-05-26AK: Rename FileSystemPath -> LexicalPathSergey Bugaev
And move canonicalized_path() to a static method on LexicalPath. This is to make it clear that FileSystemPath/canonicalized_path() only perform *lexical* canonicalization.
2020-05-25LibLine: Change get_line to return a Result<String, Error>AnotherTest
This fixes a bunch of FIXME's in LibLine. Also handles the case where read() would read zero bytes in vt_dsr() and effectively block forever by erroring out. Fixes #2370
2020-05-25Shell: Warn the user about active jobs on exitAnotherTest
And make sure that the user means to exit and kill current jobs before exiting.
2020-05-25Shell: Parse and correctly evaluate 'command &' and 'command &&'AnotherTest
This commit adds the InBackground and ShortCircuitOnFailure attributes to commands, which respectively cause the command to be run in the background, and abort the command chain with exit status != 0.