Skip to content

Commit d41823a

Browse files
committed
Add --git-credentials option
1 parent 906d771 commit d41823a

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/Phug/Split/Command/Dist.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ class Dist extends Analyze
3333
*/
3434
public $gitProgram = 'git';
3535

36+
/**
37+
* @option git-credentials
38+
*
39+
* Git credentials.
40+
*
41+
* @var string
42+
*/
43+
public $gitCredentials = '';
44+
3645
/**
3746
* @param Split $cli
3847
*
@@ -157,6 +166,12 @@ protected function distributePackage(Split $cli, array $package, string $branch)
157166
$directory = $this->output."/$name";
158167

159168
$cli->writeLine("git clone $url $directory", 'light_green');
169+
170+
if (strlen($this->gitCredentials)) {
171+
[$protocol, $url] = explode('://', $url, 2);
172+
$url = $protocol.'://'.$this->gitCredentials.'@'.$url;
173+
}
174+
160175
$cli->gray();
161176
$this->git("clone $url $directory");
162177
$cli->ungray();

0 commit comments

Comments
 (0)