-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-push.php
executable file
·41 lines (34 loc) · 1.27 KB
/
git-push.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env php
<?php
declare(strict_types=1);
use function rosasurfer\ministruts\docopt;
use function rosasurfer\ministruts\echof;
if (!is_file($autoload = __DIR__.'/../../../../../vendor/autoload.php')) {
echo "File \"$autoload\" not found".PHP_EOL;
exit(1);
}
require($autoload);
$doc = <<<DOCOPT
Usage: git push [options] [<repository> [<refspec>...]]
-h, --help
-v, --verbose be more verbose
-q, --quiet be more quiet
--repo <repository> repository
--all push all refs
--mirror mirror all refs
--delete delete refs
--tags push tags (can't be used with --all or --mirror)
-n, --dry-run dry run
--porcelain machine-readable output
-f, --force force updates
--thin use thin pack
--receive-pack <receive-pack>
receive pack program
--exec <receive-pack> receive pack program
-u, --set-upstream set upstream for git pull/status
--progress force progress reporting
DOCOPT;
$result = docopt($doc);
foreach ($result as $key => $value) {
echof($key.': '.json_encode($value, JSON_THROW_ON_ERROR).(($type=gettype($value))=='NULL' ? '':" ($type)"));
}