Andreas Kling
ddbe6bd7b4
Userland: Rename Core::Object to Core::EventReceiver
...
This is a more precise description of what this class actually does.
2023-08-06 20:39:51 +02:00
Andreas Kling
26647f2b10
LibCore: Remove the Core::Objects::all_objects() list
...
Nobody actually used the list of all Core::Objects anyway.
2023-08-06 18:09:25 +02:00
ronak69
1453028975
Shell: Color bareword yellow if it's a prefix of at least one command
...
Before, if a bareword wasn't a runnable program's filename it got
colored red and white otherwise. Now, additionally it will be checked if
it is a "prefix" of a possible command and colored yellow if it is and
red if not.
Coloring this way provides another "feedback" to the user: If while
typing out a command name the color changes from yellow to red then a
typo occurred :^)
To check if a bareword is a prefix the `Shell::complete_program_name()`
function is utilized (if pressing tab gives you some suggestions then it
is a prefix).
2023-08-04 23:27:59 +03:30
Ali Mohammad Pur
da7bf5f785
Shell: Add support for the '!' POSIX pipeline prefix
...
This prefix simply inverts the exit code of the pipeline, which we
implement using the 'not' builtin.
2023-08-04 13:28:59 +03:30
Ali Mohammad Pur
b6d7c5fb0e
Shell: Correctly track nested expansions in POSIX mode
...
Previously any expansion closing sequence would've caused the entire
expansion chain to be terminated, fix this by keeping track of active
expansions and running the parser in 'skip' mode.
Fixes #19110 .
2023-08-04 13:28:59 +03:30
Shannon Booth
8751be09f9
AK: Serialize URL hosts with 'concept-host-serializer'
...
In order to follow spec text to achieve this, we need to change the
underlying representation of a host in AK::URL to deserialized format.
Before this, we were parsing the host and then immediately serializing
it again.
Making that change resulted in a whole bunch of fallout.
After this change, callers can access the serialized data through
this concept-host-serializer. The functional end result of this
change is that IPv6 hosts are now correctly serialized to be
surrounded with '[' and ']'.
2023-07-31 05:18:51 +02:00
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