diff --git a/README.md b/README.md index 53c0ca1..55ed662 100644 --- a/README.md +++ b/README.md @@ -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? @@ -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 diff --git a/src/Artifact.php b/src/Artifact.php index c3323b9..81f5369 100644 --- a/src/Artifact.php +++ b/src/Artifact.php @@ -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. diff --git a/src/Commands/ArtifactCommand.php b/src/Commands/ArtifactCommand.php index b22a8d3..fee46dc 100644 --- a/src/Commands/ArtifactCommand.php +++ b/src/Commands/ArtifactCommand.php @@ -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.') @@ -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()); diff --git a/src/app.php b/src/app.php index 030e762..899ea18 100644 --- a/src/app.php +++ b/src/app.php @@ -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(); diff --git a/tests/phpunit/Functional/GeneralTest.php b/tests/phpunit/Functional/GeneralTest.php index a14ea47..c6da843 100644 --- a/tests/phpunit/Functional/GeneralTest.php +++ b/tests/phpunit/Functional/GeneralTest.php @@ -17,7 +17,7 @@ class GeneralTest extends AbstractFunctionalTestCase { public function testHelp(): void { $output = $this->runGitArtifactCommand('--help'); $this->assertStringContainsString('artifact [options] [--] ', 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 {