-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
up: update composer lock and update script
- Loading branch information
Showing
5 changed files
with
94 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
// kite mycmd.php | ||
// kite mycmd.php [opts] [args] | ||
|
||
use Toolkit\Cli\Cli; | ||
use Toolkit\PFlag\CliCmd; | ||
use Toolkit\PFlag\FlagsParser; | ||
|
||
|
||
// load kite boot file, allow use all class in the kite. | ||
$kiteBootFile = getenv('KITE_BOOT_FILE'); | ||
if (!$kiteBootFile || !is_file($kiteBootFile)) { | ||
throw new RuntimeException("kite boot file is not exists", 1); | ||
} | ||
|
||
echo "... load kite boot file: ", $kiteBootFile, "\n\n"; | ||
require $kiteBootFile; | ||
|
||
// can use toolkit/pflag, more please see https://github.com/php-toolkit/pflag | ||
|
||
CliCmd::new() | ||
->config(function (CliCmd $cmd) { | ||
$cmd->name = 'cgen'; | ||
$cmd->desc = 'quickly generate a blog or doc markdown file'; | ||
|
||
// config flags | ||
$cmd->options = [ | ||
'i,interactive' => 'bool;interactive set config', | ||
't,tpl-file' => 'the tempalte file;;', | ||
]; | ||
// or use property | ||
// $cmd->arguments = [...]; | ||
}) | ||
// ->withArguments([ | ||
// 'arg1' => 'this is arg1, is string' | ||
// ]) | ||
->setHandler('handle_func') | ||
->run(); | ||
|
||
function handle_func(FlagsParser $fs) | ||
{ | ||
Cli::info("hello"); | ||
vdump( | ||
$fs->getScriptFile() . implode(' ', $fs->getFlags()), | ||
$fs->getOpts() | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters