Undefine
0374351595
Shell: Properly detect the kill executable
2023-05-21 14:59:26 +01:00
Ben Wiederhake
f0ee630ee9
Shell: Prefer File::read_until_eof over DeprecatedFile::read_all
2023-05-19 21:36:37 +02:00
Ben Wiederhake
e77f59b7d3
Shell: Prefer FileSystem over DeprecatedFile
2023-05-15 06:50:43 +02:00
Ben Wiederhake
bc2a517ade
Userland: Merge DEFAULT_PATH into LibFileSystem/FileSystem.h
2023-05-13 07:53:13 +02:00
Lucas CHOLLET
8c34959b53
AK: Add the Input
word to input-only buffered streams
...
This concerns both `BufferedSeekable` and `BufferedFile`.
2023-05-09 11:18:46 +02:00
Ali Mohammad Pur
24c7995743
Shell: Rename the verb {lookup => look_up}
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
4d00b372c8
Shell: Make the builtins' POSIX mode requirement more explicit
...
Instead of checking in each individual function, add the mode to
ENUMERATE_SHELL_BUILTINS() and let has_builtin() handle it.
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
367da548ff
Shell: Make null_or_alternative actually look up the given variable
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
1403e56535
Shell: Place all variables in the closest nonlocal frame in POSIX mode
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
0d8b90aec6
Shell: Allow newlines before do
in POSIX for loops
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
fca5a34ad3
Shell: Allow assignment-prefixed commands to run builtins
...
`env` is not capable of running shell builtins, so make a simple
builtin in its place.
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
e2336d9de5
Shell: Add support for unset -v
in POSIX mode
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
71441ea932
Shell: Allow lossy conversion from list -> string in POSIX mode
...
Similar to bash, this operation returns only the first element because
reasons.
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
8a042cd9cb
Shell: Allow non-exhaustive 'case' statements in POSIX
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
ef551a045d
Shell: Add support for the POSIX 'read' builtin
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
aecd91aedc
Shell: Correctly handle escaped quote characters in strings
...
Previously "foo\`bar" was treated literally, but \` is a valid escape
character.
This commit makes that string correctly evaluate as "foo`bar".
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
bbfedf17b7
Shell: Actually execute loop/case bodies when running them
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
7b031138fc
Shell: Correctly handle commands after heredoc contents
...
Previously we did not emit a newline after the ending heredoc key, which
wreaked havoc on the parser logic, leading to parse errors.
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
93413f8682
Shell: Use the correct range for named variable expansions
...
Previously we were starting the variable expansions before the starting
'$' and calculating the wrong length, this commit makes it so we
calculate the right range for them.
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
79c76d67ce
Shell: Add the 'break' and 'continue' POSIX builtins
...
These only support n=1 for now.
2023-05-05 09:35:24 +03:30
Andreas Kling
3de8dd921e
Userland: Remove serialize-to-JSON functions only used for Inspector
2023-04-25 14:48:40 +02:00
Andreas Kling
411d36719e
LibCore: Simplify Core::Notifier by only allowing one event type
...
Not a single client of this API actually used the event mask feature to
listen for readability AND writability.
Let's simplify the API and have only one hook: on_activation.
2023-04-25 14:48:40 +02:00
Cameron Youell
da305017de
Shell: Use JsonArray::append
in save_to
...
We can convert it into a failable function here easily
2023-04-24 09:21:51 +02:00
Cameron Youell
8134dccdc7
AK: Add new failable JsonArray::{append/set}
functions
...
Move all old usages to the more explicit `JsonArray:must_{append/set}`
2023-04-24 09:21:51 +02:00
Tim Schumacher
8370377832
Shell: Add map_fixed
to the pledges for command autocompletion
2023-04-12 07:06:54 -04:00
Ben Wiederhake
560133a0c6
Everywhere: Remove unused DeprecatedString includes
2023-04-09 22:00:54 +02:00
Ali Mohammad Pur
1173adb90a
Shell: Don't require ArgsParser values to be null-terminated
2023-03-31 06:55:46 +02:00
Tim Schumacher
d01ac59b82
Shell: Skip rc files when not running interactively
...
This makes debugging a bit nicer.
2023-03-29 03:39:09 +03:30
Tim Schumacher
9a6b5a53a7
Shell: Correctly mark the end line of a parsed list
2023-03-29 03:39:09 +03:30
Tim Schumacher
46c22ee49d
Shell: Allow appending empty string literals
...
Otherwise, we just silently drop arguments that are empty strings.
2023-03-29 03:39:09 +03:30
Tim Schumacher
c26639eac2
Shell: Properly skip POSIX Fi
tokens
2023-03-29 03:39:09 +03:30
Tim Schumacher
b1739029ef
Shell: Evaluate the program name before parsing arguments
...
Otherwise, we are too late to catch the "load the POSIX-compatible
shellrc" branch.
2023-03-29 03:39:09 +03:30
Ali Mohammad Pur
7c312980b0
Shell: Implement arithmetic expansions for POSIX mode
...
This also adds a 'math' immediate function that can be used in Shell
proper to do arithmetic stuff.
2023-03-22 09:46:16 +01:00
Ali Mohammad Pur
d0112d76e9
Shell: Resolve nonexistent string env variables to the empty string
...
We did this for lists, but not for strings.
2023-03-22 09:46:16 +01:00
Ali Mohammad Pur
d997b794fa
Shell: Load a different rc file when in POSIX mode
2023-03-22 09:46:16 +01:00
Cameron Youell
1d24f394c6
Everywhere: Use LibFileSystem
where trivial
2023-03-21 19:03:21 +00:00
Sam Atkins
6d8f046fd0
LibGfx+Userland: Make TextAttributes::underline_style optional
...
Rather than having a style AND a field saying whether to use the style,
just make the style Optional.
2023-03-15 14:55:49 +01:00
Tim Schumacher
ecd1862859
AK: Rename Stream::write_entire_buffer to Stream::write_until_depleted
...
No functional changes.
2023-03-13 15:16:20 +00:00
Tim Schumacher
a3f73e7d85
AK: Rename Stream::read_entire_buffer to Stream::read_until_filled
...
No functional changes.
2023-03-13 15:16:20 +00:00
Ali Mohammad Pur
56b5b78d7b
Shell: Error out on invalid `export' argument
...
Previously `export =` would crash the shell, make this an error instead.
2023-03-10 22:33:30 +03:30
Andreas Kling
4797fad91c
Shell: Fix bogus C-style casts from NonnullOwnPtr<T>*
to T*
...
Thanks UBSAN for spotting this!
2023-03-07 09:42:20 +01:00
Andreas Kling
21db2b7b90
Everywhere: Remove NonnullOwnPtr.h includes
2023-03-06 23:46:35 +01:00
Andreas Kling
359d6e7b0b
Everywhere: Stop using NonnullOwnPtrVector
...
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-03-06 23:46:35 +01:00
Andreas Kling
689ca370d4
Everywhere: Remove NonnullRefPtr.h includes
2023-03-06 23:46:35 +01:00
Andreas Kling
8a48246ed1
Everywhere: Stop using NonnullRefPtrVector
...
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-06 23:46:35 +01:00
Ali Mohammad Pur
500044906d
LibCore+Everywhere: Remove ArgsParser::add*(char const*&)
...
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-03-01 10:47:19 +01:00
Linus Groh
51c3967516
Everywhere: Use '_{short_,}string' literals more
...
This mostly updates code what was written before but merged after these
were added.
2023-02-28 15:15:36 +00:00
Ali Mohammad Pur
db886fe18b
Userland+AK: Stop using getopt() for ArgsParser
...
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-28 15:52:24 +03:30
Ali Mohammad Pur
b2b851b361
Shell: Convert the POSIX parser/lexer to ErrorOr
2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
0c28fd41ed
Shell: Convert all immediately convertible fallible functions to ErrorOr
2023-02-28 15:52:24 +03:30