Timothy Flynn
c911781c21
Everywhere: Remove needless trailing semi-colons after functions
...
This is a new option in clang-format-16.
2023-07-08 10:32:56 +01:00
Cameron Youell
978fe3c6d5
Shell: Add option Produce symbolic output
to umask
...
Its a standard posix option thats always nice to have :^)
2023-07-02 11:19:10 -06:00
Ali Mohammad Pur
1c1aa2c0d0
Shell: Handle (most) errors in the parsers
...
This turns all errors into either "OOM" or a proper shell error (if
propagation is impossible or meaningless).
Fixes `echo -en '\xfe\x4a' | $SHELL` crashing.
2023-07-01 17:01:54 +03:30
Hendiadyoin1
3d83d70cac
Shell: Stop lying about string types
2023-06-13 01:49:02 +02:00
Ali Mohammad Pur
1696411f66
Shell: Reset the custom Shell keybinds before calling Editor::get_line()
...
Fixes #19301 .
2023-06-12 10:44:44 +03:30
Ben Wiederhake
f20d04726a
LibFileSystem+Everything: Remove resolve_executable_from_environment
2023-06-06 23:46:36 +02:00
jwijenbergh
9531abcb1a
Shell: Add a "." builtin that aliases to "source" in POSIX
...
This patch adds an alias to the source builtin when an user types ".".
We cannot just add an enumeration entry using __ENUMERATE_SHELL_BUILTIN
because "." is not a valid name in a function.
This patch adds handling similarly to the name rewriting of ":".
This alias is limited to POSIX mode only.
2023-06-05 09:25:11 +03:30
Ben Wiederhake
365b2bf945
Shell: Prefer File and FileSystem over DeprecatedFile
2023-05-30 00:21:59 +02:00
Ben Wiederhake
0c86ee3876
Shell: Rewrite Shell::possibly_print_error without deprecated API
...
Also, not allocating copies of the current string all the time should be
a tiny bit more efficient. We can do this because the 'current_line' is
only used while reporting the error, so it will not be used once we
begin reading the next line.
2023-05-30 00:21:59 +02:00
Ben Wiederhake
8df8f4d75a
Shell: Rewrite Shell::runnable_path_for without deprecated API
...
Also, not allocating a vector for the parts should be a tiny bit more
efficient.
2023-05-30 00:21:59 +02:00
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