Skip to content
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

Updated command description. #73

Merged
merged 1 commit into from
Mar 8, 2024
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
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