-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-add.php
executable file
·38 lines (30 loc) · 1.23 KB
/
git-add.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
#!/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 add [options] [--] [<filepattern>...]
-h, --help
-n, --dry-run dry run
-v, --verbose be verbose
-i, --interactive interactive picking
-p, --patch select hunks interactively
-e, --edit edit current diff and apply
-f, --force allow adding otherwise ignored files
-u, --update update tracked files
-N, --intent-to-add record only the fact that the path will be added later
-A, --all add all, noticing removal of tracked files
--refresh don't add, only refresh the index
--ignore-errors just skip files which cannot be added because of errors
--ignore-missing check if - even missing - files are ignored in dry run
DOCOPT;
$result = docopt($doc);
foreach ($result as $key => $value) {
echof($key.': '.json_encode($value, JSON_THROW_ON_ERROR).(($type=gettype($value))=='NULL' ? '':" ($type)"));
}