ladybird/Userland/Shell
Vetrox 0e26f2657e Shell: Add where builtin
The builtin is based on the behaviour of the z-shell.
Namely it tries to resolve every argument one by one.

When resolving (in the order below) the following results can occur:
  1. The argument is a shell built-in command. Then print it.
  2. The argument is an alias. In this case we print the mapped value.
  3. The argument was found in the `PATH` environment variable.
     In this case we print the resolved absolute path
     and try to find more occurences in the `PATH` environment variable.
  4. None of the above. If no earlier argument got resolved,
     we print the error `{argument} not found`.

If at least one argument got resolved we exit with exit code 0,
otherwise 1.

By not using Core::File to resolve the executable in the environment
but rather using a modified version of the code we print every
matching executable of the given name. This behaviour matches
up with the z-shell.

The builtin has the following flags to modify the behaviour according
to the users needs:
  - `-p --path-only`: This skips the built-in and alias checks
  (step 1 & 2)
  - `-s --follow-symlink`: This follows the symlinks of an executable to
  its symlink-free location.
  - `-w --type`: This displays the type of the found object
  without any additional descriptive information.
2022-12-27 07:25:42 +03:30
..
Tests Everywhere: Fix a variety of typos 2022-09-14 04:46:49 +00:00
AST.cpp Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
AST.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
Builtin.cpp Shell: Add where builtin 2022-12-27 07:25:42 +03:30
CMakeLists.txt Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
Execution.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
Formatter.cpp Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
Formatter.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
Forward.h Shell: Add support for heredocs 2021-04-29 20:25:56 +02:00
ImmediateFunctions.cpp Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
Job.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
Job.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
main.cpp Shell: Disable interactive mode on '-c' 2022-12-12 13:57:06 +00:00
NodeVisitor.cpp Shell: Add support for regex match patterns 2022-04-18 19:53:10 +04:30
NodeVisitor.h Shell: Add support for heredocs 2021-04-29 20:25:56 +02:00
Parser.cpp Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
Parser.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
Shell.cpp Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
Shell.h Shell: Add where builtin 2022-12-27 07:25:42 +03:30
SyntaxHighlighter.cpp Everywhere: Replace single-char StringView op. arguments with chars 2022-07-12 23:11:35 +02:00
SyntaxHighlighter.h LibSyntax: Teach each highlighter about it's comment syntax 2022-11-27 18:28:43 -07:00