mirror of
https://github.com/n3w/helpers-cli-input.git
synced 2025-12-21 05:33:29 +00:00
Compare commits
No commits in common. "master" and "1.2.2.1" have entirely different histories.
4 changed files with 36 additions and 2 deletions
|
|
@ -16,6 +16,11 @@
|
||||||
"pointybeard/helpers-foundation-factory": "~1.0",
|
"pointybeard/helpers-foundation-factory": "~1.0",
|
||||||
"pointybeard/helpers-functions-flags": "~1.0"
|
"pointybeard/helpers-functions-flags": "~1.0"
|
||||||
},
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"pointybeard/helpers-functions-strings": "~1.1.0",
|
||||||
|
"pointybeard/helpers-cli-colour": "~1.0",
|
||||||
|
"pointybeard/helpers-functions-cli": "~1.1.0"
|
||||||
|
},
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/pointybeard/helpers-cli-input/issues",
|
"issues": "https://github.com/pointybeard/helpers-cli-input/issues",
|
||||||
"wiki": "https://github.com/pointybeard/helpers-cli-input/wiki"
|
"wiki": "https://github.com/pointybeard/helpers-cli-input/wiki"
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||||
include __DIR__.'/../vendor/autoload.php';
|
include __DIR__.'/../vendor/autoload.php';
|
||||||
|
|
||||||
use pointybeard\Helpers\Cli\Input;
|
use pointybeard\Helpers\Cli\Input;
|
||||||
|
use pointybeard\Helpers\Cli\Colour\Colour;
|
||||||
use pointybeard\Helpers\Functions\Cli;
|
use pointybeard\Helpers\Functions\Cli;
|
||||||
|
|
||||||
// Define what we are expecting to get from the command line
|
// Define what we are expecting to get from the command line
|
||||||
|
|
@ -63,6 +64,34 @@ try {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Display the manual in green text
|
||||||
|
echo Cli\manpage(
|
||||||
|
basename(__FILE__),
|
||||||
|
'1.0.2',
|
||||||
|
'An example script for the PHP Helpers: Command-line Input and Input Type Handlers composer library (pointybeard/helpers-cli-input).',
|
||||||
|
$collection,
|
||||||
|
Colour::FG_GREEN,
|
||||||
|
Colour::FG_WHITE,
|
||||||
|
[
|
||||||
|
'Examples' => 'php -f example/example.php -- -vvv -d example/example.json import',
|
||||||
|
]
|
||||||
|
).PHP_EOL.PHP_EOL;
|
||||||
|
|
||||||
|
// example.php 1.0.2, An example script for the PHP Helpers: Command-line Input
|
||||||
|
// and Input Type Handlers composer library (pointybeard/helpers-cli-input).
|
||||||
|
// Usage: example.php [OPTIONS]... ACTION...
|
||||||
|
//
|
||||||
|
// Arguments:
|
||||||
|
// ACTION The name of the action to perform
|
||||||
|
//
|
||||||
|
// Options:
|
||||||
|
// -v verbosity level. -v (errors only), -vv
|
||||||
|
// (warnings and errors), -vvv (everything).
|
||||||
|
// -d, --data=VALUE Path to the input JSON data
|
||||||
|
//
|
||||||
|
// Examples:
|
||||||
|
// php -f example/example.php -- -vvv -d example/example.json import
|
||||||
|
|
||||||
var_dump($argv->find('action'));
|
var_dump($argv->find('action'));
|
||||||
// string(6) "import"
|
// string(6) "import"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,6 @@ class Argument extends Input\AbstractInputType
|
||||||
$second[$ii] = $secondaryLineLeadPadding.$second[$ii];
|
$second[$ii] = $secondaryLineLeadPadding.$second[$ii];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $first.implode(PHP_EOL, $second);
|
return $first.implode($second, PHP_EOL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,6 @@ class LongOption extends Input\AbstractInputType
|
||||||
$second[$ii] = $secondaryLineLeadPadding.$second[$ii];
|
$second[$ii] = $secondaryLineLeadPadding.$second[$ii];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $first.implode(PHP_EOL, $second);
|
return $first.implode($second, PHP_EOL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue