Skip to content

Added shell:clear command #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions features/shell_clear.feature
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions src/PHPCR/Shell/Console/Application/ShellApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
26 changes: 26 additions & 0 deletions src/PHPCR/Shell/Console/Command/Shell/ClearCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace PHPCR\Shell\Console\Command\Shell;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class ClearCommand extends Command
{
public function configure()
{
$this->setName('shell:clear');
$this->setDescription('Clear the screen');
$this->setHelp(<<<EOT
Clear the screen
EOT
);
}

public function execute(InputInterface $input, OutputInterface $output)
{
$output->write("\033[2J\033[;H");
}
}

1 change: 1 addition & 0 deletions src/PHPCR/Shell/Resources/config.dist/alias.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down