summaryrefslogtreecommitdiff
path: root/Shell
AgeCommit message (Collapse)Author
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-06-01LibLine: Handle interrupts againAnotherTest
This commit makes LibLine handle interrupts (as reported via interrupted() and resized()) again. There is a little catch with the shell: ``` $ ls | pipe> <C-c> (prompt stays here until a key is pressed) ```
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-26Userland et al: Pledge sigaction when neededSergey Bugaev
* In some cases, we can first call sigaction()/signal(), then *not* pledge sigaction. * In other cases, we pledge sigaction at first, call sigaction()/signal() second, then pledge again, this time without sigaction. * In yet other cases, we keep the sigaction pledge. I suppose these could all be migrated to drop it or not pledge it at all, if somebody is interested in doing that.
2020-05-25Shell: Refuse to be suspended with ^ZAnotherTest
Suspending the shell while interacting with it is pretty weird, so let's just disallow this behaviour.
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.
2020-05-25Shell: Kill existing jobs when exitingAnotherTest
2020-05-25Shell: Add the `disown' shell builtinAnotherTest
2020-05-23Shell: Take whitespace into account when suggesting tokensAnotherTest
Prior to this, we did not care if there was any whitespace after the last token in the prompt, and this caused a regression: ``` > lsp <tab> > lsp ci ```
2020-05-21LibLine: Correctly track the completion start and endAnotherTest
To achieve this, the API was tweaked a bit to allow for easier tracking of completions. This API change is non-disruptive to any application that does not use anchored styles.
2020-05-21Shell: Attach links to completed pathsAnotherTest
``` ls ./Ter<tab> ``` gets you a link to ./Terminal.ini, right in the prompt.
2020-05-20LibLine: Unify completion hooks and adapt its usersAnotherTest
LibLine should ultimately not care about what a "token" means in the context of its user, so force the user to split the buffer itself. This also allows the users to pick up contextual clues as well, since they have to lex the line themselves. This commit pacthes Shell and the JS repl to better handle completions, so certain wrong behaviours are now corrected as well: - JS repl can now complete "Object . getOw<tab>" - Shell can now complete "echo | ca<tab>" and paths inside strings
2020-05-18LibLine: Handle unicode correctlyAnotherTest
This commit also fixes a problem with us throwing out data that was inserted while a command was running.
2020-05-17Shell: Treat builtin names as programs and suggest themAnotherTest
2020-05-17Shell: Print the full name of missing interpretersAndreas Kling
We were missing two characters at the end due to a mix-up when skipping over the first two characters ("#!")
2020-05-17Shell: Switch to using Core::EventLoopAnotherTest
This commit refactors Shell to a Core::Object and switches its looping to Core::EventLoop.
2020-05-17Shell: Patch most of the builtins to use Core::ArgsParserAnotherTest
The remaining one is 'pushd', which seems to have relatively complex logic with regards to its arguments.
2020-05-17Shell: Add job control capabilitiesAnotherTest
This patchset adds the `jobs`, `fg` and `bg` builtins.
2020-05-16Shell: Properly handle parser syntax errorsLinus Groh
In the case of a syntax error the shell parser prints an error message to stderr and returns an empty Vector<Command> - in that case we shouldn't try to determine whether or not we can continue parsing but abort immediately - is_complete() expects that *something* was parsed successfully. Fixes #2251.
2020-05-16Shell: Use DirIterator::SkipParentAndBaseDirShannon Booth
2020-05-15Shell: Correct program stop behaviourAnotherTest
Prior to this, we would only wait for program exit; the shell should stop waiting once the program has been stopped. Fixes #2230
2020-05-15Shell: Print correct errno when execvp() failsSergey Bugaev
Amusingly enough, this was caused by yet another bug.
2020-05-14Build: Switch to CMake :^)Sergey Bugaev
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-13Shell: Break out of continuation when ^C is pressedAnotherTest
This fixes the little issue with Shell not allowing cancellation of commands once they were in continuation mode ``` $ ls ' $ # No matter what we do here, we cannot escape 'ls' ```
2020-05-10Shell: Hyperlink output from "pwd" and "dirs" built-ins :^)Andreas Kling
2020-05-10Shell: Support basic syntax highlightingAnotherTest
2020-05-10Shell: Parse commentsAnotherTest
2020-05-10Shell: Include some metadata in parsed tokens and ask for continuationAnotherTest
This patchset adds some metadata to Parser::parse() which allows the Shell to ask for the rest of a command, if it is not complete. A command is considered complete if it has no trailing pipe, or unterminated string.
2020-05-04Shell: Check for invalid #! in commandsAndrew Kaster
2020-04-30Shell: Provide the correct invariant length to the line editorAnotherTest
2020-04-30Shell+LibLine: Handle escaped characters correctlyAnotherTest
This patchset fixes incorrect handling of escaped tokens (`a\ b`) in Shell autocompletion and LibLine. The users of LibLine can now choose between two token splitting modes, either taking into account escapes, or ignoring them.
2020-04-30Shell: Correctly parse quoted filenames in redirectionAnotherTest
This commit fixes the (incorrect) behaviour of treating quotes as part of the redirection filename. Fixes #1857 :^)
2020-04-27Shell: use access() syscall to check if files are executable by userStephan Unverwerth
2020-04-26Kernel: Added the ability to set the hostname via new syscallLuke Payne
Userland/hostname: Now takes parameter to set the hostname LibC/unistd: Added sethostname function
2020-04-21LibCore: Make Core::File::open() return a Result<NNRP<File>, String>Andreas Kling
It was impractical to return a RefPtr<File> since that left us no way to extract the error string. This is usually needed for the UI, so the old static open() got basically no use.
2020-04-19Shell: Correct suggestion of directoriesAnotherTest
2020-04-19LibLine: Allow suggestions to have trailing trivia stringsAnotherTest
These strings would be applied when inserted into the buffer, but are not shown as part of the suggestion. This commit also patches up Userland/js and Shell to use this functionality
2020-04-19Shell: Don't return early if command is in PATH and a directoryLinus Groh
2020-04-19Shell: Explicitly check if command is a directoryLinus Groh
This is a bit nicer than getting "Exec format error" after trying to execvp() a directory.