diff --git a/shell/main.cpp b/shell/main.cpp index 70c68a2b..026475af 100644 --- a/shell/main.cpp +++ b/shell/main.cpp @@ -85,6 +85,7 @@ Result luna_main(int argc, char** argv) { StringView path; StringView command; + bool interactive { false }; SharedPtr input_file; @@ -93,6 +94,7 @@ Result luna_main(int argc, char** argv) parser.add_system_program_info("sh"_sv); parser.add_positional_argument(path, "path"_sv, "-"_sv); parser.add_value_argument(command, 'c', "command"_sv, "execute a single command and then exit"_sv); + parser.add_switch_argument(interactive, 'i', "interactive"_sv, "run an interactive shell"_sv); parser.parse(argc, argv); // TODO: This does not properly handle builtins. @@ -105,7 +107,7 @@ Result luna_main(int argc, char** argv) input_file->set_close_on_exec(); } - bool interactive = isatty(input_file->fd()); + if (isatty(input_file->fd())) interactive = true; if (interactive) {