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


PHP PhutilArgumentParser::setTagline方法代码示例

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


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

示例1: dirname

 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
$root = dirname(dirname(dirname(__FILE__)));
require_once $root . '/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline('manage open Audit requests');
$args->setSynopsis(<<<EOSYNOPSIS
**audit.php** __repository_callsign__
    Close all open audit requests in a repository. This is intended to
    reset the state of an imported repository which triggered a bunch of
    spurious audit requests during import.

EOSYNOPSIS
);
$args->parseStandardArguments();
$args->parse(array(array('name' => 'more', 'wildcard' => true)));
$more = $args->getArg('more');
if (count($more) !== 1) {
    $args->printHelpAndExit();
}
$callsign = reset($more);
开发者ID:nexeck,项目名称:phabricator,代码行数:31,代码来源:audit.php

示例2: dirname

#!/usr/bin/env php
<?php 
$root = dirname(dirname(dirname(__FILE__)));
require_once $root . '/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline('manage celerity');
$args->setSynopsis(<<<EOSYNOPSIS
**celerity** __command__ [__options__]
    Manage static resources.

EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())->setAncestorClass('CelerityManagementWorkflow')->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
开发者ID:denghp,项目名称:phabricator,代码行数:16,代码来源:manage_celerity.php

示例3: dirname

#!/usr/bin/env php
<?php 
$root = dirname(dirname(dirname(__FILE__)));
require_once $root . '/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline('test InteractiveEditor class');
$args->setSynopsis(<<<EOHELP
**interactive_editor.php** [__options__]
    Edit some content via the InteractiveEditor class. This script
    makes it easier to test changes to InteractiveEditor, which is
    difficult to unit test.
EOHELP
);
$args->parseStandardArguments();
$args->parse(array(array('name' => 'fallback', 'param' => 'editor', 'help' => 'Set the fallback editor.'), array('name' => 'line', 'short' => 'l', 'param' => 'number', 'help' => 'Open at line number __number__.'), array('name' => 'name', 'param' => 'filename', 'help' => 'Set edited file name.')));
if ($args->getArg('help')) {
    $args->printHelpAndExit();
}
$editor = new PhutilInteractiveEditor("The wizard quickly\n" . "jinxed the gnomes\n" . "before they vaporized.");
$name = $args->getArg('name');
if ($name) {
    $editor->setName($name);
}
$line = $args->getArg('line');
if ($line) {
    $editor->setLineOffset($line);
}
$fallback = $args->getArg('fallback');
if ($fallback) {
    $editor->setFallbackEditor($fallback);
}
开发者ID:chaozhang80,项目名称:tool-package,代码行数:31,代码来源:interactive_editor.php

示例4: __construct

    public function __construct(array $argv)
    {
        PhutilServiceProfiler::getInstance()->enableDiscardMode();
        $original_argv = $argv;
        $args = new PhutilArgumentParser($argv);
        $args->setTagline('daemon overseer');
        $args->setSynopsis(<<<EOHELP
**launch_daemon.php** [__options__] __daemon__
    Launch and oversee an instance of __daemon__.
EOHELP
);
        $args->parseStandardArguments();
        $args->parsePartial(array(array('name' => 'trace-memory', 'help' => 'Enable debug memory tracing.'), array('name' => 'log', 'param' => 'file', 'help' => 'Send output to __file__.'), array('name' => 'daemonize', 'help' => 'Run in the background.'), array('name' => 'phd', 'param' => 'dir', 'help' => 'Write PID information to __dir__.'), array('name' => 'verbose', 'help' => 'Enable verbose activity logging.'), array('name' => 'load-phutil-library', 'param' => 'library', 'repeat' => true, 'help' => 'Load __library__.')));
        $argv = array();
        $more = $args->getUnconsumedArgumentVector();
        $this->daemon = array_shift($more);
        if (!$this->daemon) {
            $args->printHelpAndExit();
        }
        if ($args->getArg('trace')) {
            $this->traceMode = true;
            $argv[] = '--trace';
        }
        if ($args->getArg('trace-memory')) {
            $this->traceMode = true;
            $this->traceMemory = true;
            $argv[] = '--trace-memory';
        }
        if ($args->getArg('load-phutil-library')) {
            foreach ($args->getArg('load-phutil-library') as $library) {
                $argv[] = '--load-phutil-library=' . $library;
            }
        }
        $log = $args->getArg('log');
        if ($log) {
            ini_set('error_log', $log);
            $argv[] = '--log=' . $log;
        }
        $verbose = $args->getArg('verbose');
        if ($verbose) {
            $this->verbose = true;
            $argv[] = '--verbose';
        }
        $this->daemonize = $args->getArg('daemonize');
        $this->phddir = $args->getArg('phd');
        $this->argv = $argv;
        $this->moreArgs = coalesce($more, array());
        error_log("Bringing daemon '{$this->daemon}' online...");
        if (self::$instance) {
            throw new Exception('You may not instantiate more than one Overseer per process.');
        }
        self::$instance = $this;
        if ($this->daemonize) {
            // We need to get rid of these or the daemon will hang when we TERM it
            // waiting for something to read the buffers. TODO: Learn how unix works.
            fclose(STDOUT);
            fclose(STDERR);
            ob_start();
            $pid = pcntl_fork();
            if ($pid === -1) {
                throw new Exception('Unable to fork!');
            } else {
                if ($pid) {
                    exit(0);
                }
            }
        }
        if ($this->phddir) {
            $desc = array('name' => $this->daemon, 'argv' => $this->moreArgs, 'pid' => getmypid(), 'start' => time());
            Filesystem::writeFile($this->phddir . '/daemon.' . getmypid(), json_encode($desc));
        }
        $this->daemonID = $this->generateDaemonID();
        $this->dispatchEvent(self::EVENT_DID_LAUNCH, array('argv' => array_slice($original_argv, 1), 'explicitArgv' => $this->moreArgs));
        declare (ticks=1);
        pcntl_signal(SIGUSR1, array($this, 'didReceiveKeepaliveSignal'));
        pcntl_signal(SIGUSR2, array($this, 'didReceiveNotifySignal'));
        pcntl_signal(SIGINT, array($this, 'didReceiveGracefulSignal'));
        pcntl_signal(SIGTERM, array($this, 'didReceiveTerminalSignal'));
    }
开发者ID:lsubra,项目名称:libphutil,代码行数:79,代码来源:PhutilDaemonOverseer.php

示例5: glx

 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
require_once dirname(dirname(__FILE__)) . '/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline('regenerate CSS sprite sheets');
$args->setSynopsis(<<<EOHELP
**sprites**
    Rebuild CSS sprite sheets.

EOHELP
);
$args->parseStandardArguments();
$args->parse(array(array('name' => 'source', 'param' => 'directory', 'help' => 'Directory with sprite sources.')));
$srcroot = $args->getArg('source');
if (!$srcroot) {
    throw new Exception("You must specify a source directory with '--source'.");
}
$webroot = dirname(phutil_get_library_root('phabricator')) . '/webroot/rsrc';
$webroot = Filesystem::readablePath($webroot);
function glx($x)
开发者ID:rudimk,项目名称:phabricator,代码行数:31,代码来源:generate_sprites.php

示例6: dirname

#!/usr/bin/env php
<?php 
$root = dirname(dirname(dirname(__FILE__)));
require_once $root . '/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage garbage colletors'));
$args->setSynopsis(<<<EOSYNOPSIS
**garbage** __command__ [__options__]
    Manage garbage collectors.

EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())->setAncestorClass('PhabricatorGarbageCollectorManagementWorkflow')->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
开发者ID:truSense,项目名称:phabricator,代码行数:16,代码来源:manage_garbage.php

示例7: dirname

 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
$root = dirname(dirname(dirname(__FILE__)));
require_once $root . '/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline('emit a test event');
$args->setSynopsis(<<<EOHELP
**emit_test_event.php** [--listen listener] ...
  Emit a test event after installing any specified __listener__s.
EOHELP
);
$args->parseStandardArguments();
$args->parse(array(array('name' => 'listen', 'param' => 'listener', 'repeat' => true)));
$console = PhutilConsole::getConsole();
foreach ($args->getArg('listen') as $listener) {
    $console->writeOut("Installing '%s'...\n", $listener);
    newv($listener, array())->register();
}
$console->writeOut("Emitting event...\n");
PhutilEventEngine::dispatchEvent(new PhabricatorEvent(PhabricatorEventType::TYPE_TEST_DIDRUNTEST, array('time' => time())));
$console->writeOut("Done.\n");
开发者ID:nexeck,项目名称:phabricator,代码行数:31,代码来源:emit_test_event.php

示例8: dirname

#!/usr/bin/env php
<?php 
$root = dirname(dirname(dirname(__FILE__)));
require_once $root . '/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage cache'));
$args->setSynopsis(<<<EOSYNOPSIS
**cache** __command__ [__options__]
    Manage Phabricator caches.

EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorCacheManagementWorkflow')->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
开发者ID:JohnnyEstilles,项目名称:phabricator,代码行数:16,代码来源:manage_cache.php

示例9: dirname

#!/usr/bin/env php
<?php 
require_once dirname(__FILE__) . '/../../__init_script__.php';
if (!posix_isatty(STDOUT)) {
    $sid = posix_setsid();
    if ($sid <= 0) {
        throw new Exception(pht('Failed to create new process session!'));
    }
}
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('daemon executor'));
$args->setSynopsis(<<<EOHELP
**exec_daemon.php** [__options__] __daemon__ ...
    Run an instance of __daemon__.
EOHELP
);
$args->parse(array(array('name' => 'trace', 'help' => pht('Enable debug tracing.')), array('name' => 'trace-memory', 'help' => pht('Enable debug memory tracing.')), array('name' => 'verbose', 'help' => pht('Enable verbose activity logging.')), array('name' => 'label', 'short' => 'l', 'param' => 'label', 'help' => pht('Optional process label. Makes "%s" nicer, no behavioral effects.', 'ps')), array('name' => 'daemon', 'wildcard' => true)));
$trace_memory = $args->getArg('trace-memory');
$trace_mode = $args->getArg('trace') || $trace_memory;
$verbose = $args->getArg('verbose');
if (function_exists('posix_isatty') && posix_isatty(STDIN)) {
    fprintf(STDERR, pht('Reading daemon configuration from stdin...') . "\n");
}
$config = @file_get_contents('php://stdin');
$config = id(new PhutilJSONParser())->parse($config);
PhutilTypeSpec::checkMap($config, array('log' => 'optional string|null', 'argv' => 'optional list<wild>', 'load' => 'optional list<string>', 'autoscale' => 'optional wild'));
$log = idx($config, 'log');
if ($log) {
    ini_set('error_log', $log);
    PhutilErrorHandler::setErrorListener(array('PhutilDaemon', 'errorListener'));
}
开发者ID:barcelonascience,项目名称:libphutil,代码行数:31,代码来源:exec_daemon.php

示例10: dirname

#!/usr/bin/env php
<?php 
$root = dirname(dirname(dirname(__FILE__)));
require_once $root . '/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage hunks'));
$args->setSynopsis(<<<EOSYNOPSIS
**hunks** __command__ [__options__]
    Manage Differential hunk storage.

EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())->setAncestorClass('PhabricatorHunksManagementWorkflow')->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
开发者ID:pugong,项目名称:phabricator,代码行数:16,代码来源:manage_hunks.php

示例11: dirname

#!/usr/bin/env php
<?php 
$root = dirname(dirname(dirname(__FILE__)));
require_once $root . '/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage audits'));
$args->setSynopsis(<<<EOSYNOPSIS
**audit** __command__ [__options__]
    Manage Phabricator audits.

EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())->setAncestorClass('PhabricatorAuditManagementWorkflow')->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
开发者ID:truSense,项目名称:phabricator,代码行数:16,代码来源:manage_audit.php

示例12: dirname

#!/usr/bin/env php
<?php 
$root = dirname(dirname(dirname(__FILE__)));
require_once $root . '/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline('test Filesystem::getMimeType()');
$args->setSynopsis(<<<EOHELP
**mime.php** [__options__] __file__
    Determine the mime type of a file.
EOHELP
);
$args->parseStandardArguments();
$args->parse(array(array('name' => 'default', 'param' => 'mimetype', 'help' => 'Use __mimetype__ as default instead of builtin default.'), array('name' => 'file', 'wildcard' => true)));
$file = $args->getArg('file');
if (count($file) !== 1) {
    $args->printHelpAndExit();
}
$file = reset($file);
$default = $args->getArg('default');
if ($default) {
    echo Filesystem::getMimeType($file, $default) . "\n";
} else {
    echo Filesystem::getMimeType($file) . "\n";
}
开发者ID:chaozhang80,项目名称:tool-package,代码行数:24,代码来源:mime.php

示例13: dirname

#!/usr/bin/env php
<?php 
require_once dirname(__FILE__) . '/__init_script__.php';
require_once dirname(__FILE__) . '/lib/PhutilLibraryMapBuilder.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline('rebuild the library map file');
$args->setSynopsis(<<<EOHELP
    **phutil_rebuild_map.php** [__options__] __root__
        Rebuild the library map file for a libphutil library.

EOHELP
);
$args->parseStandardArguments();
$args->parse(array(array('name' => 'quiet', 'help' => 'Do not write status messages to stderr.'), array('name' => 'drop-cache', 'help' => 'Drop the symbol cache and rebuild the entire map from ' . 'scratch.'), array('name' => 'limit', 'param' => 'N', 'default' => 8, 'help' => 'Controls the number of symbol mapper subprocesses run ' . 'at once. Defaults to 8.'), array('name' => 'show', 'help' => 'Print symbol map to stdout instead of writing it to the ' . 'map file.'), array('name' => 'ugly', 'help' => 'Use faster but less readable serialization for --show.'), array('name' => 'root', 'wildcard' => true)));
$root = $args->getArg('root');
if (count($root) !== 1) {
    throw new Exception("Provide exactly one library root!");
}
$root = Filesystem::resolvePath(head($root));
$builder = new PhutilLibraryMapBuilder($root);
$builder->setQuiet($args->getArg('quiet'));
$builder->setSubprocessLimit($args->getArg('limit'));
if ($args->getArg('drop-cache')) {
    $builder->dropSymbolCache();
}
if ($args->getArg('show')) {
    $builder->setShowMap(true);
    $builder->setUgly($args->getArg('ugly'));
}
$builder->buildMap();
exit(0);
开发者ID:chaozhang80,项目名称:tool-package,代码行数:31,代码来源:phutil_rebuild_map.php

示例14: isExecutable

#!/usr/bin/env php
<?php 
require_once dirname(dirname(__FILE__)) . '/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('crazy workflow delegation'));
$args->setSynopsis(<<<EOHELP
**subworkflow.php** do echo __args__ ...
  Echo some stuff using a convoluted series of delegate workflows.
EOHELP
);
// This shows how to do manual parsing of raw arguments.
final class PhutilEchoExampleArgumentWorkflow extends PhutilArgumentWorkflow
{
    public function isExecutable()
    {
        return true;
    }
    public function shouldParsePartial()
    {
        return true;
    }
    public function execute(PhutilArgumentParser $args)
    {
        $unconsumed = $args->getUnconsumedArgumentVector();
        echo implode(' ', $unconsumed) . "\n";
        return 0;
    }
}
// This shows how to delegate to sub-workflows.
final class PhutilDoExampleArgumentWorkflow extends PhutilArgumentWorkflow
{
开发者ID:pritambaral,项目名称:libphutil,代码行数:31,代码来源:subworkflow.php

示例15: dirname

#!/usr/bin/env php
<?php 
$root = dirname(dirname(dirname(__FILE__)));
require_once $root . '/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage lipsum'));
$args->setSynopsis(<<<EOSYNOPSIS
**lipsum** __command__ [__options__]
    Manage Phabricator Test Data Generator.

EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())->setAncestorClass('PhabricatorLipsumManagementWorkflow')->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
开发者ID:patelhardik,项目名称:phabricator,代码行数:16,代码来源:manage_lipsum.php


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