Skip to content

Commit c9a43bc

Browse files
committed
added print help
1 parent 2e6bbed commit c9a43bc

File tree

6 files changed

+229
-0
lines changed

6 files changed

+229
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor/

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
install:
2+
composer install
3+
4+
validate:
5+
composer validate
6+
7+
lint:
8+
composer exec --verbose phpcs -- --standard=PSR12 src bin

bin/gendiff

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
require_once __DIR__ . '/../vendor/autoload.php';
5+
6+
use function App\runGendiff;
7+
8+
runGendiff();

composer.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "hexlet/code",
3+
"description": "Diff generator",
4+
"type": "project",
5+
"require": {
6+
"docopt/docopt": "^1.0.6"
7+
},
8+
"require-dev": {
9+
"squizlabs/php_codesniffer": "^3.7"
10+
},
11+
"license": "MIT",
12+
"autoload": {
13+
"psr-4": {
14+
"App\\": "src/"
15+
},
16+
"files": [
17+
"vendor/docopt/docopt/src/docopt.php",
18+
"src/Gendiff.php"
19+
]
20+
},
21+
"authors": [
22+
{
23+
"name": "Alexsey-VR",
24+
"email": "[email protected]"
25+
}
26+
],
27+
"bin": [
28+
"bin/gendiff"
29+
]
30+
}

composer.lock

Lines changed: 151 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Gendiff.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace App;
4+
5+
//require_once __DIR__ . '/../vendor/autoload.php';
6+
7+
use Docopt;
8+
9+
function runGendiff()
10+
{
11+
$doc = <<<'DOCOPT'
12+
gendiff -h
13+
14+
Generate diff
15+
16+
Usage:
17+
gendiff (-h|--help)
18+
gendiff (-v|--version)
19+
20+
Options:
21+
-h --help Show this screen
22+
-v --version Show version
23+
24+
DOCOPT;
25+
26+
$result = Docopt::handle($doc, array('version' => '1.0.6'));
27+
28+
foreach ($result as $k => $v) {
29+
print_r($k . ': ' . json_encode($v) . PHP_EOL);
30+
}
31+
}

0 commit comments

Comments
 (0)