mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:07:43 +00:00
Shell: Add a 'setopt' builtin
This builtin sets (and unsets) boolean flags that alter the behaviour of the shell. The only flags added are - inline_exec_keep_empty_segments: Keep empty segments in the result of splitting $(...) by $IFS - verbose: Announce each command before executing it It should be noted that the (rather extreme) verbosity of the names is intentional, and will hopefully be alleviated by the next commit :^)
This commit is contained in:
parent
d6de2b5828
commit
b8d1edb2a2
5 changed files with 66 additions and 3 deletions
|
@ -52,12 +52,17 @@
|
|||
__ENUMERATE_SHELL_BUILTIN(dirs) \
|
||||
__ENUMERATE_SHELL_BUILTIN(pushd) \
|
||||
__ENUMERATE_SHELL_BUILTIN(popd) \
|
||||
__ENUMERATE_SHELL_BUILTIN(setopt) \
|
||||
__ENUMERATE_SHELL_BUILTIN(time) \
|
||||
__ENUMERATE_SHELL_BUILTIN(jobs) \
|
||||
__ENUMERATE_SHELL_BUILTIN(disown) \
|
||||
__ENUMERATE_SHELL_BUILTIN(fg) \
|
||||
__ENUMERATE_SHELL_BUILTIN(bg)
|
||||
|
||||
#define ENUMERATE_SHELL_OPTIONS() \
|
||||
__ENUMERATE_SHELL_OPTION(inline_exec_keep_empty_segments, false, "Keep empty segments in inline execute $(...)") \
|
||||
__ENUMERATE_SHELL_OPTION(verbose, false, "Announce every command that is about to be executed")
|
||||
|
||||
class Shell;
|
||||
|
||||
class Shell : public Core::Object {
|
||||
|
@ -135,6 +140,15 @@ public:
|
|||
ReadLine,
|
||||
};
|
||||
|
||||
#define __ENUMERATE_SHELL_OPTION(name, default_, description) \
|
||||
bool name { default_ };
|
||||
|
||||
struct Options {
|
||||
ENUMERATE_SHELL_OPTIONS();
|
||||
} options;
|
||||
|
||||
#undef __ENUMERATE_SHELL_OPTION
|
||||
|
||||
private:
|
||||
Shell();
|
||||
virtual ~Shell() override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue