summaryrefslogtreecommitdiff
path: root/Userland/Shell
AgeCommit message (Collapse)Author
2023-04-12Shell: Add `map_fixed` to the pledges for command autocompletionTim Schumacher
2023-04-09Everywhere: Remove unused DeprecatedString includesBen Wiederhake
2023-03-31Shell: Don't require ArgsParser values to be null-terminatedAli Mohammad Pur
2023-03-29Shell: Skip rc files when not running interactivelyTim Schumacher
This makes debugging a bit nicer.
2023-03-29Shell: Correctly mark the end line of a parsed listTim Schumacher
2023-03-29Shell: Allow appending empty string literalsTim Schumacher
Otherwise, we just silently drop arguments that are empty strings.
2023-03-29Shell: Properly skip POSIX `Fi` tokensTim Schumacher
2023-03-29Shell: Evaluate the program name before parsing argumentsTim Schumacher
Otherwise, we are too late to catch the "load the POSIX-compatible shellrc" branch.
2023-03-22Shell: Implement arithmetic expansions for POSIX modeAli Mohammad Pur
This also adds a 'math' immediate function that can be used in Shell proper to do arithmetic stuff.
2023-03-22Shell: Resolve nonexistent string env variables to the empty stringAli Mohammad Pur
We did this for lists, but not for strings.
2023-03-22Shell: Load a different rc file when in POSIX modeAli Mohammad Pur
2023-03-21Everywhere: Use `LibFileSystem` where trivialCameron Youell
2023-03-15LibGfx+Userland: Make TextAttributes::underline_style optionalSam Atkins
Rather than having a style AND a field saying whether to use the style, just make the style Optional.
2023-03-13AK: Rename Stream::write_entire_buffer to Stream::write_until_depletedTim Schumacher
No functional changes.
2023-03-13AK: Rename Stream::read_entire_buffer to Stream::read_until_filledTim Schumacher
No functional changes.
2023-03-10Shell: Error out on invalid `export' argumentAli Mohammad Pur
Previously `export =` would crash the shell, make this an error instead.
2023-03-07Shell: Fix bogus C-style casts from `NonnullOwnPtr<T>*` to `T*`Andreas Kling
Thanks UBSAN for spotting this!
2023-03-06Everywhere: Remove NonnullOwnPtr.h includesAndreas Kling
2023-03-06Everywhere: Stop using NonnullOwnPtrVectorAndreas Kling
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-03-06Everywhere: Remove NonnullRefPtr.h includesAndreas Kling
2023-03-06Everywhere: Stop using NonnullRefPtrVectorAndreas Kling
This class had slightly confusing semantics and the added weirdness doesn't seem worth it just so we can say "." instead of "->" when iterating over a vector of NNRPs. This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-03-01LibCore+Everywhere: Remove ArgsParser::add*(char const*&)Ali Mohammad Pur
This is not guaranteed to always work correctly as ArgsParser deals in StringViews and might have a non-properly-null-terminated string as a value. As a bonus, using StringView (and DeprecatedString where necessary) leads to nicer looking code too :^)
2023-02-28Everywhere: Use '_{short_,}string' literals moreLinus Groh
This mostly updates code what was written before but merged after these were added.
2023-02-28Userland+AK: Stop using getopt() for ArgsParserAli Mohammad Pur
This commit moves the implementation of getopt into AK, and converts its API to understand and use StringView instead of char*. Everything else is caught in the crossfire of making Option::accept_value() take a StringView instead of a char const*. With this, we must now pass a Span<StringView> to ArgsParser::parse(), applications using LibMain are unaffected, but anything not using that or taking its own argc/argv has to construct a Vector<StringView> for this method.
2023-02-28Shell: Convert the POSIX parser/lexer to ErrorOrAli Mohammad Pur
2023-02-28Shell: Convert all immediately convertible fallible functions to ErrorOrAli Mohammad Pur
2023-02-28Shell: Convert the remaining fallible AST functions to ErrorOrAli Mohammad Pur
2023-02-28Shell: Make Immediate expression invocation fallibleAli Mohammad Pur
This removes a whole bunch of FIXMEs in the immediate expr implementations as well :^)
2023-02-28Shell: Convert builtins to use the modern main() styleAli Mohammad Pur
That is, return ErrorOr<int>, handle fallible ops with TRY() and accept a Main::Arguments. Note that we do not populate the argc/argv members of Main::Arguments, so all accesses have to go through .strings.
2023-02-28Shell: Make AST::dump() ErrorOr-awareAli Mohammad Pur
2023-02-28Shell+LibCodeComprehension: Start replacing {Deprecated => }StringAli Mohammad Pur
This starts by switching all AST members to Strings, and dealing with the fallout.
2023-02-21Shell: Fix (and paper over) various const-correctness issuesAndreas Kling
2023-02-18Shell: Correct the out-of-bounds expansion bailing conditionAli Mohammad Pur
Also adds a couple (useful) debug prints which helped track down the problem.
2023-02-18Shell: Allow underscores in normal expansion namesAli Mohammad Pur
2023-02-18Shell: Correctly keep track of special parameter lengthAli Mohammad Pur
We were previously treating special expansions (e.g. $#) as zero-length expansions, which made the shell repeat them literally after expanding them.
2023-02-18Shell: Clear expansions after committing a word in the POSIX parserAli Mohammad Pur
2023-02-18Shell: Add support for heredocs to the POSIX parserAli Mohammad Pur
2023-02-18Shell: Add a '--posix' mode to the 'dump' builtinAli Mohammad Pur
2023-02-18Shell: Allow the heredoc node to act as a redirection tooAli Mohammad Pur
This will be used in a future commit to implement POSIX sh heredocs.
2023-02-13Everywhere: Use /bin/Shell as the shebang for Shell scriptsAli Mohammad Pur
2023-02-13Shell: Use the POSIX parser if run as /bin/sh or passed the --posix flagAli Mohammad Pur
Note that the default shellrc is most likely not valid posix sh code, so passing --skip-shellrc is suggested until we come up with a separate shellrc file for the POSIX parser to use when interactive.
2023-02-13Shell: Start implementing a POSIX-compliant parserAli Mohammad Pur
The parser is still very much a work-in-progress, but it can currently parse most of the basic bits, the only *completely* unimplemented things in the parser are: - heredocs (io_here) - alias expansion - arithmetic expansion There are a whole suite of bugs, and syntax highlighting is unreliable at best. For now, this is not attached anywhere, a future commit will enable it for /bin/sh or a `Shell --posix` invocation.
2023-02-13LibCore: Remove `Stream.h`Tim Schumacher
2023-02-13LibCore: Rename `File` to `DeprecatedFile`Tim Schumacher
As usual, this removes many unused includes and moves used includes further down the chain.
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: