Skip to content

Commit

Permalink
Enable querying the application version
Browse files Browse the repository at this point in the history
  • Loading branch information
u01jmg3 committed Jan 1, 2019
1 parent 5261d8b commit 7c70578
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docx2md.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

class Docx2md
{
const DOCX2MD_VERSION = '1.0.3';
const PHP_SAPI_NAME = 'cli';
const DOM_VERSION = '1.0';
const DOM_ENCODING = 'UTF-8';
Expand Down Expand Up @@ -108,7 +109,7 @@ private function docx2md(array $args, $isTestMode = false)
shell_exec('chcp 65001');

// Check command line options
$longOptionsArray = array('debug:', 'image', 'test');
$longOptionsArray = array('debug:', 'image', 'test', 'version');

$shortOptionsArray = array_map(function ($value) {
return substr($value, 0, 1) . preg_replace('/[a-zA-Z0-9]/', '', $value);
Expand Down Expand Up @@ -164,7 +165,9 @@ private function docx2md(array $args, $isTestMode = false)
// Re-index the array
$args = array_values($args);

if (count($args) <= 0) {
if (!empty($optionVersion)) {
die(self::GREEN . 'Docx2md ' . self::WHITE . 'version ' . self::YELLOW . self::DOCX2MD_VERSION . self::WHITE);
} elseif (count($args) <= 0) {
// If option is set and not already in test mode
// run tests and *stop*
if (!empty($optionTest) && !$isTestMode) {
Expand All @@ -188,6 +191,9 @@ private function docx2md(array $args, $isTestMode = false)
$output .= self::GREEN . ' -t, --test' . self::WHITE;
$output .= ' Output test results then terminate';
$output .= PHP_EOL;
$output .= self::GREEN . ' -v, --version' . self::WHITE;
$output .= ' Display this application version';
$output .= PHP_EOL;
$output .= PHP_EOL;
$output .= 'If no destination file is specified, output will be written to the console excluding any images.';
$output .= PHP_EOL;
Expand Down

0 comments on commit 7c70578

Please sign in to comment.