コード例 #1
0
ファイル: disqus-cli.php プロジェクト: compwright/disqus-cli
}
use Aura\Cli\CliFactory;
use Aura\Cli\Status;
use Aura\Cli\Help;
use Aura\Cli\Context\GetoptParser;
use Aura\Cli\Context\OptionFactory;
use Dotenv;
use DisqusAPI;
use DisqusInterfaceNotDefined;
// Aura CLI library dependencies
$auraCli = new CliFactory();
$context = $auraCli->newContext($_SERVER);
$stdio = $auraCli->newStdio();
// Assemble the script usage instructions
$help = new Help(new OptionFactory());
$help->setSummary('A lightweight command line client for the Disqus API');
$help->setUsage("<resource> <verb> [optionlist]");
$help->setDescr('For a full list of Disqus API resources, verbs, and options, visit https://disqus.com/api/docs');
$help->setOptions($options);
// Parse the command line
$optionsParser = new GetoptParser(new OptionFactory());
$optionsParser->setOptions($options);
$optionsParser->parseInput($context->argv->get());
try {
    // Load the configuration .env file
    Dotenv::load(getcwd());
    Dotenv::required(['DISQUS_API_KEY', 'DISQUS_API_SECRET', 'DISQUS_ACCESS_TOKEN']);
} catch (\RuntimeException $e) {
    $stdio->errln($e->getMessage());
    exit(Status::CONFIG);
} catch (\InvalidArgumentException $e) {
コード例 #2
0
ファイル: Application.php プロジェクト: nochso/writeme
 /**
  * @return \Aura\Cli\Help
  */
 private function createHelp()
 {
     $help = new Help(new OptionFactory());
     $help->setSummary('Write me to read me.');
     $help->setUsage(['[options] [--] <file>']);
     $help->setOptions($this->getOptions());
     $help->setDescr('Convert a WRITEME template to its README counterpart. e.g. WRITEME.md will be written to README.md. Override this using option --target or front-matter key "target"');
     return $help;
 }