Skip to content

Commit

Permalink
10 default parameter (#12)
Browse files Browse the repository at this point in the history
* Fix link href

* Fix #10 - do not pass null

* Handle not setting pattern argument better
  • Loading branch information
g105b authored Feb 15, 2021
1 parent eebe9f6 commit 863c606
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Command/SyncCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Gt\Sync\Command;

use Gt\Cli\Argument\ArgumentValueList;
use Gt\Cli\Argument\ArgumentValueListNotSetException;
use Gt\Cli\Command\Command;
use Gt\Cli\Parameter\NamedParameter;
use Gt\Cli\Parameter\Parameter;
Expand All @@ -11,7 +12,12 @@ class SyncCommand extends Command {
public function run(ArgumentValueList $arguments = null):void {
$source = $arguments->get("source");
$destination = $arguments->get("destination");
$pattern = $arguments->get("pattern");
try {
$pattern = $arguments->get("pattern");
}
catch(ArgumentValueListNotSetException $exception) {
$pattern = null;
}

$sync = new DirectorySync($source, $destination, $pattern);
$sync->exec();
Expand Down

0 comments on commit 863c606

Please sign in to comment.