Skip to content

Commit

Permalink
feat(bin): add clish entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Dec 26, 2019
1 parent 1a36015 commit b6dfe0f
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions bin/clish
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env php
<?php

if (\PHP_VERSION_ID < 70100) {
echo "Phint requires PHP7.1 or newer\n";

exit(1);
}

if (\Phar::running() && !\extension_loaded('zlib')) {
echo "Phint.phar requires 'zlib' extension\n(OR you can compile phar with `compression: NONE` in box.json)\n";

exit(1);
}

if (\file_exists(__DIR__ . '/../../../autoload.php')) {
require __DIR__ . '/../../../autoload.php';
} elseif (\file_exists(__DIR__ . '/../../autoload.php')) {
require __DIR__ . '/../../autoload.php';
} else {
require __DIR__ . '/../vendor/autoload.php';
}

\chdir(\getcwd());

$logo = "
_ _ _
___ | | (_) ___ | |__
/ __| | | | | / __| ' _ \
| (__ | | | | \___ \ | | | |
\___| |_| |_| |____/ |_| |_|
PHP CLI Syntax Highlight Tool
=============================
";

$app = new Ahc\Cli\Application(
'Clish',
\trim(\file_get_contents(__DIR__ . '/../VERSION'))
);

// Add commands and their aliases
$app->add(new Ahc\CliSyntax\Console\ClishCommand, 'c', true);

$app->logo($logo)->handle($_SERVER['argv'] + ['', 'clish']);

0 comments on commit b6dfe0f

Please sign in to comment.