当前位置: 首页>>代码示例>>PHP>>正文


PHP Cli::addOption方法代码示例

本文整理汇总了PHP中Cli::addOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Cli::addOption方法的具体用法?PHP Cli::addOption怎么用?PHP Cli::addOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cli的用法示例。


在下文中一共展示了Cli::addOption方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: minify_images

 public static function minify_images()
 {
     $path = Cli::addOption("path", WWW_PATH, "Path where to find images");
     $norun = Cli::addSwitch("n", "Do not run the scripts, only print files to process");
     Cli::enableHelp();
     Cli::pinfo("Minify images");
     foreach (self::globRecursive($path . "/*.[pP][nN][gG]", GLOB_NOSORT) as $png) {
         Cli::pinfo(" * {$png}");
         $output = "";
         $return_var = -1;
         $cmd = "pngcrush -ow -brute -reduce {$png}";
         if ($norun) {
             Logger::Debug("   > {$cmd}");
         } else {
             exec("{$cmd} 2>& 1", $output, $return_var);
             if ($return_var != 0) {
                 Cli::perr(implode($output, "\n"));
             } else {
                 Logger::Debug(implode($output, "\n"));
             }
         }
     }
     foreach (self::globRecursive($path . "/{*.[jJ][pP][gG], *.[jJ][pP][eE][gG]}", GLOB_BRACE | GLOB_NOSORT) as $jpg) {
         Cli::pinfo(" * {$jpg}");
         $output = "";
         $return_var = -1;
         $cmd = "jpegoptim -s -v -v {$jpg}";
         if ($norun) {
             Logger::Debug("   > {$cmd}");
         } else {
             exec("{$cmd} 2>& 1", $output, $return_var);
             if ($return_var != 0) {
                 Cli::perr(implode($output, "\n"));
             } else {
                 Logger::Debug(implode($output, "\n"));
             }
         }
     }
 }
开发者ID:davbfr,项目名称:cf,代码行数:39,代码来源:Minifier.plugin.php

示例2: Suites

        // Test for empty set of tests
        //
        $cc = new Colors\Color();
        if (count($testClasses) == 0) {
            echo $cc("WARNING ")->red()->bold();
            echo $cc("  No classes have been named to be test Suites (Test????) - ")->reset();
            echo $cc(" is this correct !!")->white()->bold();
            echo "\n";
        } else {
            foreach ($runner->get_test_cases() as $obj) {
                $arr = $obj->get_tests();
                if (count($arr) == 0) {
                    echo $cc("WARNING")->red()->bold();
                    echo $cc(" class ")->reset();
                    echo $cc(get_class($obj))->cyan()->bold();
                    echo $cc(" has no tests method (test_???) - ")->reset();
                    echo $cc(" is this correct ")->white()->bold();
                    echo "\n ";
                }
            }
        }
        $runner->print_results();
    }
}
$cli = new Cli();
$cli->addOption()->shortName('c')->longname(LiteTestCommand::CONFIG_FILE)->key(LiteTestCommand::CONFIG_FILE)->valueRequired(true)->setIsFile()->description("json config file");
$cli->addOption()->shortName('b')->longname(LiteTestCommand::BOOTSTRAP_FILE)->key(LiteTestCommand::BOOTSTRAP_FILE)->valueRequired(true)->setIsFile()->description("php bootstrap file");
$cli->addOption()->shortName("v")->key('verbose')->valueRequired(false)->description("verbose")->valueRequired(false);
$cli->addOption()->shortName("d")->key('debug')->valueRequired(false)->description("debug")->valueRequired(false);
$cli->command(new LiteTestCommand())->name("LiteTest")->description("Run php test cases using LiteTest framework")->usage("[options] [arguments]")->help("Runs php test cases with LiteTest framework");
$cli->run($argv);
开发者ID:robertblackwell,项目名称:litetest,代码行数:31,代码来源:litetest.php


注:本文中的Cli::addOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。