From cd6e5c064ba9c9350b06a362ce84f5c674b2e7fe Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Mon, 18 Jan 2021 04:34:16 +0330 Subject: Shell: Add a builtin that parses its sole argument and dumps its AST Pretty useful for debugging. --- Userland/Shell/Builtin.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Userland/Shell/Builtin.cpp') 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 arguments; -- cgit v1.2.3