summaryrefslogtreecommitdiff
path: root/Userland/Shell
AgeCommit message (Collapse)Author
2023-01-29AK: Move memory streams from `LibCore`Tim Schumacher
2023-01-27AK: Remove StringBuilder::build() in favor of to_deprecated_string()Linus Groh
Having an alias function that only wraps another one is silly, and keeping the more obvious name should flush out more uses of deprecated strings. No behavior change.
2023-01-27Shell: Replace uses of JsonObject::get_deprecated()/get_ptr()Sam Atkins
2023-01-17AK+Everywhere: Rename JsonObject::get() to ::get_deprecated()Sam Atkins
This is a preparatory step to making `get()` return `ErrorOr`.
2023-01-14Shell: Use `AllocatingMemoryStream` to search for the IFSTim Schumacher
2023-01-12LibCore+Userland: Make Core::Timer::create_single_shot() return ErrorOrSam Atkins
clang-format sure has some interesting opinions about where to put a method call that comes after a lambda. :thonk:
2023-01-07Userland: Silence warnings from ElapsedTimer::elapsed() type changeAndrew Kaster
We changed elapsed() to return i64 instead of int as that's what AK::Time::to_milliseconds() returns, causing a bunch of implicit lossy conversions in callers. Clean those up with a mix of type changes and casts.
2023-01-02Everywhere: Fix badly-formatted includesBen Wiederhake
In 7c5e30daaa615ad3a2ef55222423a747ac0a1227, the focus was "only" on Userland/Libraries/, whereas this commit cleans up the remaining headers in the repo, and any new badly-formatted include.
2022-12-27Shell: Add `where` builtinVetrox
The builtin is based on the behaviour of the z-shell. Namely it tries to resolve every argument one by one. When resolving (in the order below) the following results can occur: 1. The argument is a shell built-in command. Then print it. 2. The argument is an alias. In this case we print the mapped value. 3. The argument was found in the `PATH` environment variable. In this case we print the resolved absolute path and try to find more occurences in the `PATH` environment variable. 4. None of the above. If no earlier argument got resolved, we print the error `{argument} not found`. If at least one argument got resolved we exit with exit code 0, otherwise 1. By not using Core::File to resolve the executable in the environment but rather using a modified version of the code we print every matching executable of the given name. This behaviour matches up with the z-shell. The builtin has the following flags to modify the behaviour according to the users needs: - `-p --path-only`: This skips the built-in and alias checks (step 1 & 2) - `-s --follow-symlink`: This follows the symlinks of an executable to its symlink-free location. - `-w --type`: This displays the type of the found object without any additional descriptive information.
2022-12-12Shell: Disable interactive mode on '-c'Ali Mohammad Pur
This also disables the full suite of interactive stuff in LibLine.
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-11-27LibSyntax: Teach each highlighter about it's comment syntaxKyle Lanmon
2022-11-03Shell: Re-block SIGTT{IN,OU} on startAli Mohammad Pur
This also shows up when trying to read from a 0x0 buffer as it has no PTY attached, avoid the mess by just blocking them (instead of ignoring them).
2022-11-01Everywhere: Mark dependencies of most targets as PRIVATETim Schumacher
Otherwise, we end up propagating those dependencies into targets that link against that library, which creates unnecessary link-time dependencies. Also included are changes to readd now missing dependencies to tools that actually need them.
2022-10-24AK+Everywhere: Turn bool keep_empty to an enum in split* functionsdemostanis
2022-10-16CMake+Userland: Use CMakeLists from Userland to build Lagom LibrariesAndrew Kaster
Also do this for Shell. This greatly simplifies the CMakeLists in Lagom, replacing many glob patterns with a big list of libraries. There are still a few special libraries that need some help to conform to the pattern, like LibELF and LibWebView. It also lets us remove essentially all of the Serenity or Lagom binary directory detection logic from code generators, as now both projects directories enter the generator logic from the same place.
2022-10-10Userland: Remove unecessary uses of __serenity__ macroAndrew Kaster
2022-10-10Everywhere: Replace uses of __serenity__ with AK_OS_SERENITYAndrew Kaster
Now that we have OS macros for essentially every supported OS, let's try to use them everywhere.
2022-09-29AK+Everywhere: Replace "protocol" with "scheme" url helpersnetworkException
URL had properly named replacements for protocol(), set_protocol() and create_with_file_protocol() already. This patch removes these function and updates all call sites to use the functions named according to the specification. See https://url.spec.whatwg.org/#concept-url-scheme
2022-09-16Shell: Fix 'Command:' output for built-in 'time' commandBen Wiederhake
2022-09-14Everywhere: Fix a variety of typosBrian Gianforcaro
Spelling fixes found by `codespell`.
2022-09-12Shell: Sort CompletionSuggestions for paths lexicographicallyBen Wiederhake
This used to be ordered by inode, which can be surprising.
2022-09-08AK: Allow creating NonnullPtrVectors from an initializer listSam Atkins
This was present in Vector already. Clang-format fixed some const positions automatically too. Also removed a now-ambiguous and unnecessary constructor from Shell.
2022-08-23Userland: Consolidate most PATH resolving into a single implementationTim Schumacher
We previously had at least three different implementations for resolving executables in the PATH, all of which had slightly different characteristics. Merge those into a single implementation to keep the behaviour consistent, and maybe to make that implementation more configurable in the future.
2022-08-23Userland: Rely on a single authoritative source for the default `PATH`Tim Schumacher
2022-08-11Shell: Avoid StringView OOB access in Formatter ctorAli Mohammad Pur
2022-08-11Shell: Stop printing 'sh -c' commandsAli Mohammad Pur
That's getting too spammy and too useless.
2022-07-17Shell: Add the |& construct for piping stderr along with stdoutsin-ack
When |& is typed, stderr will be piped to stdout before the actual piping happens. This behaves basically like a 2>&1 | (and the underlying implementation transforms it to that anyway).
2022-07-14LibCore: Replace the ArgsParser option argument setting with an enumTim Schumacher
Replacement conditions for `requires_argument` have been chosen based on what would be most convenient for implementing an eventual optional argument mode.
2022-07-12Everywhere: Replace single-char StringView op. arguments with charssin-ack
This prevents us from needing a sv suffix, and potentially reduces the need to run generic code for a single character (as contains, starts_with, ends_with etc. for a char will be just a length and equality check). No functional changes.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-07-12Everywhere: Explicitly specify the size in StringView constructorssin-ack
This commit moves the length calculations out to be directly on the StringView users. This is an important step towards the goal of removing StringView(char const*), as it moves the responsibility of calculating the size of the string to the user of the StringView (which will prevent naive uses causing OOB access).
2022-07-12Userland: Convert command line arguments to String/StringViewsin-ack
StringView was used where possible. Some utilities still use libc functions which expect null-terminated strings, so String objects were used there instead.
2022-07-08Userland: Add `/usr/local/sbin` to `PATH` by defaultTim Schumacher
`e2fsprogs` adds its tools there.
2022-07-04Shell: Immediately resolve value when setting a variableAli Mohammad Pur
The lazy resolution mechanism made it so that the variables were linked together, causing unexpected behaviour: true x=$? # expected: x=0 false echo $x # expected: 0, actual: 1
2022-06-24Shell: Ignore SIGCHLD after a few unsuccessful attempts at handling itAli Mohammad Pur
As noted by the comment, a stray SIGCHLD can make the shell go into an infinite loop, pretend the signal doesn't exist after trying 10 times in 5ms.
2022-05-21LibCodeComprehension: Re-organize code comprehension related codeItamar
This moves all code comprehension-related code to a new library, LibCodeComprehension. This also moves some types related to code comprehension tasks (such as autocomplete, find declaration) out of LibGUI and into LibCodeComprehension.
2022-04-21Shell: Highlight commands with a hyperlink to open their help pagesForLoveOfCats
2022-04-18Shell: Make program-based completion with no actual token possibleAli Mohammad Pur
31ca48e made this default to paths, but now that we have a few sensible ways to complete things, let's make those work too. For instance, prior to this `kill <tab>` would've suggested paths, but now it will suggest processes.
2022-04-18LibLine: Make it possible to avoid autocompletion if requestedAli Mohammad Pur
Setting 'allow_commit_without_listing' to false will now make LibLine show the suggestion before actually committing to it; this is useful for completions that will replace all the user input, where mistakes can go unnoticed without some visual cue.
2022-04-18LibLine: Respect the provided completion static offsetAli Mohammad Pur
Now that we can resolve these correctly and they're per-suggestion, we can finally use them for their intended purpose of letting suggestions overwrite stuff in the buffer.
2022-04-18Shell: Allow completions to request further action from the shellAli Mohammad Pur
The shell now expects a JSON object of the form {"kind":<kind>,...} per line in the standard output of the completion process, where 'kind' is one of: - "plain": Just a plain suggestion. - "program": Prompts the shell to complete a program name starting with the given "name". - "proxy": Prompts the shell to act as if a completion for "argv" was requested. - "path": Prompts the shell to complete a path given the "base" and "part" (same as completing part in cwd=base).
2022-04-18Shell: Add support for regex match patternsAli Mohammad Pur
We previously allowed globs as match pattern, but for more complex matching needs, it's nice to have regular expressions. And as the existing "name a part of the match" concept maps nicely to named capture groups, we can simply reuse the same code and make groups with names available in the match body.
2022-04-15Shell: Complete for current path when the text is emptyDamien Firmenich
For example, when typing `cd <tab>`, the shell will show a list of files in the current directory. This behavior is similar to typing `cd ./<tab>`. It makes it easier to `cd` into directories without having to list them first.
2022-04-11Shell: Read script arguments as Strings instead of char*sSam Atkins
This saves work in places that previously had to create a `Vector<String>` anyway, or repeatedly cast the char* to a String. Plus, Strings are nicer than char*. :^)
2022-04-09LibGfx: Move other font-related files to LibGfx/Font/Simon Wanner
2022-04-03Shell: Use default execpromises parameter to `pledge(..)`Brian Gianforcaro
2022-04-03Shell: Refresh PATH cache after running shellrc filesHumberto Alves
This fixes the highlight of runnable commands, whenever PATH variable is changed in one of the shellrc files.
2022-04-01Everywhere: Run clang-formatIdan Horowitz