-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from Toflar/feature/cleanuptx-command
Added cleanup-tx command for purging the .tx folder from within the toolbox.
- Loading branch information
Showing
4 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace CyberSpectrum\Command; | ||
|
||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
use Symfony\Component\Finder\Finder; | ||
|
||
class CleanUpTx extends CommandBase | ||
{ | ||
protected function configure() | ||
{ | ||
parent::configure(); | ||
|
||
$this->setName('cleanup-tx'); | ||
$this->setDescription('Purges the defined .tx folder.'); | ||
$this->setHelp('Purges the defined .tx folder. You can use this little helper command to quickly start from zero again.' . PHP_EOL); | ||
} | ||
|
||
protected function getLanguageBasePath() | ||
{ | ||
return $this->txlang; | ||
} | ||
|
||
protected function isNotFileToSkip($basename) | ||
{ | ||
return true; | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$finder = new Finder(); | ||
$fs = new Filesystem(); | ||
$fs->remove($finder->directories()->in($this->getLanguageBasePath())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters