Skip to content

Commit

Permalink
Updated command description.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Mar 8, 2024
1 parent 4b08cee commit b8ef6f6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
## What is it?

A tool to assemble a code artifact from your codebase, eliminate unwanted files,
A tool to assemble a code artifact from your codebase, remove unnecessary files,
and push it into a separate Git repository.

## Why?
Expand Down Expand Up @@ -150,7 +150,7 @@ fully-configured [example in the DrevOps project](https://github.com/drevops/dre
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
Push artifact of current repository to remote git repository.
Assemble a code artifact from your codebase, remove unnecessary files, and push it into a separate Git repository.

### Adding dependencies

Expand Down
2 changes: 1 addition & 1 deletion src/Artifact.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function __construct(
}

/**
* Push artifact of current repository to remote git repository.
* Assemble a code artifact from your codebase.
*
* @param string $remote
* Path to the remote git repository.
Expand Down
9 changes: 8 additions & 1 deletion src/Commands/ArtifactCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ class ArtifactCommand extends Command {
*/
protected function configure(): void {
$this->setName('artifact');
$this->setDescription('Push artifact of current repository to remote git repository.');

$this->setDescription('Assemble a code artifact from your codebase, remove unnecessary files, and push it into a separate Git repository.');

$this->addArgument('remote', InputArgument::REQUIRED, 'Path to the remote git repository.');

$this
->addOption('branch', NULL, InputOption::VALUE_REQUIRED, 'Destination branch with optional tokens.', '[branch]')
->addOption('debug', NULL, InputOption::VALUE_NONE, 'Print debug information.')
Expand Down Expand Up @@ -91,15 +94,19 @@ protected function configure(): void {
*/
protected function execute(InputInterface $input, OutputInterface $output): int {
$gitWrapper = new GitWrapper();

$optionDebug = $input->getOption('debug');

if (($optionDebug || $output->isDebug())) {
$logger = new Logger('git');
$logger->pushHandler(new StreamHandler('php://stdout', Level::Debug));
$gitWrapper->addLoggerEventSubscriber(new GitLoggerEventSubscriber($logger));
}

$fileSystem = new Filesystem();
$artifact = new Artifact($gitWrapper, $fileSystem, $output);
$remote = $input->getArgument('remote');

// @phpstan-ignore-next-line
$artifact->artifact($remote, $input->getOptions());

Expand Down
2 changes: 2 additions & 0 deletions src/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
use Symfony\Component\Console\Application;

$application = new Application();

$command = new ArtifactCommand();
$application->add($command);
$application->setDefaultCommand((string) $command->getName(), TRUE);

$application->run();
2 changes: 1 addition & 1 deletion tests/phpunit/Functional/GeneralTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GeneralTest extends AbstractFunctionalTestCase {
public function testHelp(): void {
$output = $this->runGitArtifactCommand('--help');
$this->assertStringContainsString('artifact [options] [--] <remote>', implode(PHP_EOL, $output));
$this->assertStringContainsString('Push artifact of current repository to remote git repository.', implode(PHP_EOL, $output));
$this->assertStringContainsString('Assemble a code artifact from your codebase, remove unnecessary files, and push it into a separate Git repository.', implode(PHP_EOL, $output));
}

public function testCompulsoryParameter(): void {
Expand Down

0 comments on commit b8ef6f6

Please sign in to comment.