Skip to content

Commit

Permalink
added docopt.php first try
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-xz committed Jan 12, 2024
1 parent eeb2c8f commit 14828e3
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor/
26 changes: 26 additions & 0 deletions bin/gendiff
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
$doc = <<<DOC
Generate diff
Usage:
gendiff (-h|--help)
gendiff (-v|--version)
Options:
-h --help Show this screen
-v --version Show version
DOC;

$autoloadPath1 = __DIR__ . '/../../../autoload.php';
$autoloadPath2 = __DIR__ . '/../vendor/autoload.php';

if (file_exists($autoloadPath1)) {
require_once $autoloadPath1;
} else {
require_once $autoloadPath2;
}
$args = Docopt::handle($doc, array('version'=>'Generate diff'));
foreach ($args as $k=>$v)
echo $k.': '.json_encode($v).PHP_EOL;
14 changes: 14 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "hexlet/code",
"description": "calculate diferencies",
"license": "MIT",
"authors": [
{
"name": "Vladimir",
"email": "[email protected]"
}
],
"require": {
"docopt/docopt": "^1.0"
}
}
66 changes: 66 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 14828e3

Please sign in to comment.