diff --git a/CHANGELOG.md b/CHANGELOG.md index ddc22f92..03ee51d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ dev-master ### Features +- [shell] Added "shell:clear" command to support clearing the console output - [general] The shell supports being embedded as a dependency - [node:edit] New command `node:edit` enables editing of entire node diff --git a/features/shell_clear.feature b/features/shell_clear.feature new file mode 100644 index 00000000..6d7c4025 --- /dev/null +++ b/features/shell_clear.feature @@ -0,0 +1,11 @@ +Feature: clear the screen + In order to clear the screen + As a user + I want to be able to execute a command which does that. + + Background: + Given that I am logged in as "testuser" + + Scenario: Execute the shell clear command + Given I execute the "shell:clear" command + Then the command should not fail diff --git a/src/PHPCR/Shell/Console/Application/ShellApplication.php b/src/PHPCR/Shell/Console/Application/ShellApplication.php index 9fe76ec0..56f1ea53 100644 --- a/src/PHPCR/Shell/Console/Application/ShellApplication.php +++ b/src/PHPCR/Shell/Console/Application/ShellApplication.php @@ -227,6 +227,7 @@ protected function registerShellCommands() { // add shell-specific commands $this->add(new CommandShell\AliasListCommand()); + $this->add(new CommandShell\ClearCommand()); $this->add(new CommandShell\ConfigInitCommand()); $this->add(new CommandShell\ConfigReloadCommand()); $this->add(new CommandShell\PathChangeCommand()); diff --git a/src/PHPCR/Shell/Console/Command/Shell/ClearCommand.php b/src/PHPCR/Shell/Console/Command/Shell/ClearCommand.php new file mode 100644 index 00000000..74d85cc0 --- /dev/null +++ b/src/PHPCR/Shell/Console/Command/Shell/ClearCommand.php @@ -0,0 +1,26 @@ +setName('shell:clear'); + $this->setDescription('Clear the screen'); + $this->setHelp(<<write("\033[2J\033[;H"); + } +} + diff --git a/src/PHPCR/Shell/Resources/config.dist/alias.yml b/src/PHPCR/Shell/Resources/config.dist/alias.yml index 798aca8b..274189a1 100644 --- a/src/PHPCR/Shell/Resources/config.dist/alias.yml +++ b/src/PHPCR/Shell/Resources/config.dist/alias.yml @@ -2,6 +2,7 @@ aliases: shell:alias:list creload: shell:config:reload cinit: shell:config:init +clear: shell:clear # MySQL commands use: workspace:use {arg1}