diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2021-01-18 04:34:16 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-19 08:19:43 +0100 |
commit | cd6e5c064ba9c9350b06a362ce84f5c674b2e7fe (patch) | |
tree | 5ec4b11d4ed3d2839f87f42492f94b999ffc5248 /Userland/Shell/Builtin.cpp | |
parent | 39af1f8519d4a33a90ae79e5b3277652aac85270 (diff) | |
download | serenity-cd6e5c064ba9c9350b06a362ce84f5c674b2e7fe.zip |
Shell: Add a builtin that parses its sole argument and dumps its AST
Pretty useful for debugging.
Diffstat (limited to 'Userland/Shell/Builtin.cpp')
-rw-r--r-- | Userland/Shell/Builtin.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Shell/Builtin.cpp b/Userland/Shell/Builtin.cpp index d3a48b5089..731710af43 100644 --- a/Userland/Shell/Builtin.cpp +++ b/Userland/Shell/Builtin.cpp @@ -40,6 +40,15 @@ extern char** environ; namespace Shell { +int Shell::builtin_dump(int argc, const char** argv) +{ + if (argc != 2) + return 1; + + Parser { argv[1] }.parse()->dump(0); + return 0; +} + int Shell::builtin_alias(int argc, const char** argv) { Vector<const char*> arguments; |