Ali Mohammad Pur
fde174645a
Shell: Accept empty set of completions from program completer
...
Falling back to default completions goes directly against the users'
wishes :P
2023-12-01 19:24:57 +03:30
Ali Mohammad Pur
ad4470bc39
Shell: Escape program-provided completions unless they're marked as code
...
This makes it so program-provided completions don't have to worry about
escaping, making the Shell the only authority on escaping.
2023-11-17 11:02:02 +03:30
Adam Harald Jørgensen
e2f9011a8d
Shell: Improve error propagation
...
This commit replaces 31 release_value_but_fixme_should_propagate_errors
calls with TRYs. :^)
2023-11-14 20:08:27 +03:30
Adam Harald Jørgensen
e89ba794d0
Shell: Include parent and base directories in expanded globs
2023-11-14 20:08:27 +03:30
Adam Harald Jørgensen
cc157629b4
Shell: Expand glob to only directories if it ends with a slash
...
The glob "*/" should only expand to directories, and the directories
should also have a trailing slash. This commit also replaces
Shell::split_path with StringView::split_view since it accomplishes the
same task.
2023-11-14 20:08:27 +03:30
hanaa12G
e6c363ac63
Shell: Allow to parse command interactively when hitting Enter key
2023-11-11 14:44:10 +03:30
Adam Harald Jørgensen
a1cdfe1b54
Shell: Add support for showing shortened prompt path with ellipsis
2023-11-07 07:46:52 +03:30
Adam Harald Jørgensen
4febd31dba
Shell: Shorten prompt path if integer is provided with "\w" option
2023-11-07 07:46:52 +03:30
Adam Harald Jørgensen
491d61a2fd
Shell: Add support for escaping backslash in prompt sequence
2023-10-26 22:33:38 +03:30
Adam Harald Jørgensen
050c73d301
Shell: Add support for showing custom format time in prompt with "\D{}"
2023-10-26 22:33:38 +03:30
Adam Harald Jørgensen
e40955e9c6
Shell: Add support for showing current time in prompt with "\{t|T|@}"
2023-10-26 22:33:38 +03:30
Adam Harald Jørgensen
3d42e68265
Shell: Add support for showing number of jobs in prompt with "\j"
2023-10-26 22:33:38 +03:30
Adam Harald Jørgensen
f81bc8b045
Shell: Add support for showing the history number in prompt with "\!"
2023-10-26 22:33:38 +03:30
Adam Harald Jørgensen
f597d7c730
Shell: Add command to history before running, instead of after
2023-10-26 22:33:38 +03:30
Adam Harald Jørgensen
78b3703586
Shell: Refactor Shell::prompt to use GenericLexer to read the PROMPT var
2023-10-26 22:33:38 +03:30
implicitfield
2745b48e16
Shell: Don't try to cast NonnullRefPtrs when priting debug output
...
Fixes a regression from 8a48246e
.
2023-10-22 02:02:35 +03:30
Ali Mohammad Pur
a8c7448ccb
Shell: Implement the return
POSIX builtin
...
This is also available in the regular shell mode, as it's a generally
useful builtin to have.
2023-10-17 11:02:48 -06:00
Ali Mohammad Pur
aeee98b3a1
AK+Everywhere: Remove the null state of DeprecatedString
...
This commit removes DeprecatedString's "null" state, and replaces all
its users with one of the following:
- A normal, empty DeprecatedString
- Optional<DeprecatedString>
Note that null states of DeprecatedFlyString/StringView/etc are *not*
affected by this commit. However, DeprecatedString::empty() is now
considered equal to a null StringView.
2023-10-13 18:33:21 +03:30
Ali Mohammad Pur
84777fbe62
Shell: Allow the user to set the prompt using PROMPT()
...
This allows the prompt to be dynamically configurable, making it
possible to display various bits of information in the prompt.
2023-09-07 11:52:37 -06:00
Liav A
fb60db7b00
Shell: Add builtin command to reset the internal state
...
The new builtin command "reset" now resets the entire internal state by
virtually destructing the Shell state and re-constructing it.
This helps for example when setting a new hostname and wanting to view
it in the current Shell program.
2023-08-11 18:48:53 +03:30
Lucas CHOLLET
3f35ffb648
Userland: Prefer _string
over _short_string
...
As `_string` can't fail anymore (since 3434412
), there are no real
benefits to use the short variant in most cases.
2023-08-08 07:37:21 +02:00
Andreas Kling
34344120f2
AK: Make "foo"_string infallible
...
Stop worrying about tiny OOMs.
Work towards #20405 .
2023-08-07 16:03:27 +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
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
Ben Wiederhake
f0ee630ee9
Shell: Prefer File::read_until_eof over DeprecatedFile::read_all
2023-05-19 21:36:37 +02:00
Ben Wiederhake
bc2a517ade
Userland: Merge DEFAULT_PATH into LibFileSystem/FileSystem.h
2023-05-13 07:53:13 +02:00
Ali Mohammad Pur
24c7995743
Shell: Rename the verb {lookup => look_up}
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
Andreas Kling
3de8dd921e
Userland: Remove serialize-to-JSON functions only used for Inspector
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
Andreas Kling
359d6e7b0b
Everywhere: Stop using NonnullOwnPtrVector
...
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
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
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
0c28fd41ed
Shell: Convert all immediately convertible fallible functions to ErrorOr
2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
e403dbabfa
Shell: Convert the remaining fallible AST functions to ErrorOr
2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
007767fc14
Shell: Convert builtins to use the modern main() style
...
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-28 15:52:24 +03:30
Ali Mohammad Pur
d575c50f3e
Shell: Make AST::dump() ErrorOr-aware
2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
beeb58bd93
Shell+LibCodeComprehension: Start replacing {Deprecated => }String
...
This starts by switching all AST members to Strings, and dealing with
the fallout.
2023-02-28 15:52:24 +03:30
Andreas Kling
68b5df6bf1
Shell: Fix (and paper over) various const-correctness issues
2023-02-21 00:54:04 +01:00
Ali Mohammad Pur
4efc632e15
Shell: Allow the heredoc node to act as a redirection too
...
This will be used in a future commit to implement POSIX sh heredocs.
2023-02-18 06:55:46 +03:30
Ali Mohammad Pur
2a276c86d4
Shell: Start implementing a POSIX-compliant parser
...
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-13 23:00:15 +03:30
Tim Schumacher
874c7bba28
LibCore: Remove Stream.h
2023-02-13 00:50:07 +00:00
Tim Schumacher
d43a7eae54
LibCore: Rename File
to DeprecatedFile
...
As usual, this removes many unused includes and moves used includes
further down the chain.
2023-02-13 00:50:07 +00:00
Linus Groh
6e7459322d
AK: Remove StringBuilder::build() in favor of to_deprecated_string()
...
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-27 20:38:49 +00:00
Sam Atkins
95b1cf2dcd
Shell: Replace uses of JsonObject::get_deprecated()/get_ptr()
2023-01-27 08:07:24 -05:00