print a help message from the script
357466
def print_help(self, script_name: str):
        ''''''
        textWidth = max(60, shutil.get_terminal_size((80, 20)).columns)

        if len(script_name) > 20:
            print(f'usage: sos run {script_name}')
            print(
                '               [workflow_name | -t targets] [options] [workflow_options]'
            )
        else:
            print(
                f'usage: sos run {script_name} [workflow_name | -t targets] [options] [workflow_options]'
            )
        print(
            '  workflow_name:        Single or combined workflows defined in this script'
        )
        print('  targets:              One or more targets to generate')
        print(
            '  options:              Single-hyphen sos parameters (see "sos run -h" for details)'
        )
        print(
            '  workflow_options:     Double-hyphen workflow-specific parameters'
        )
        description = [x.lstrip('# ').strip() for x in self.description]
        description = textwrap.dedent('\n'.join(description)).strip()
        if description:
            print('\n' + description)
        #
        print('\nWorkflows:')
        print('  ' + '\n  '.join(self.workflows))
        #
        global_parameters = {}
        for section in self.sections:
            global_parameters.update(section.global_parameters)
        if global_parameters:
            print('\nGlobal Workflow Options:')
            for name, (value, comment) in global_parameters.items():
                par_str = f'  {format_par(name, value)}'
                print(par_str)
                if comment:
                    print('\n'.join(
                        textwrap.wrap(
                            comment,
                            width=textWidth,
                            initial_indent=' ' * 24,
                            subsequent_indent=' ' * 24)))
        #
        print('\nSections')
        for section in self.sections:
            section.show()
127023
def help(self):
        ''''''
        cmds = self.get_exposed_cmds()
        t = text_helper.Table(fields=['command', 'doc'],
                              lengths=[50, 85])
        return t.render((reflect.formatted_function_name(x), x.__doc__, )
                        for x in cmds.values())
806258
def print_usage (msg, exit_code=2):
    """"""
    program = sys.argv[0]
    print(_("Error: %(msg)s") % {"msg": msg}, file=console.stderr)
    print(_("Execute '%(program)s -h' for help") % {"program": program}, file=console.stderr)
    sys.exit(exit_code)
717245
def htmlHelp(self, helpString=None, title=None, istask=False, tag=None):
        
        # Check the help string.  If it turns out to be a URL, launch that,
        # if not, dump it to a quick and dirty tmp html file to make it
        # presentable, and pass that file name as the URL.
        if not helpString:
            helpString = self.getHelpString(self.pkgName+'.'+self.taskName)
        if not title:
            title = self.taskName
        lwr = helpString.lower()
        if lwr.startswith("http:") or lwr.startswith("https:") or \
           lwr.startswith("file:"):
            url = helpString
            if tag and url.find('#') < 0:
                url += '#'+tag
#           print('LAUNCHING: '+url) # DBG
            irafutils.launchBrowser(url, subj=title)
        else:
            # Write it to a temp HTML file to display
            (fd, fname) = tempfile.mkstemp(suffix='.html', prefix='editpar_')
            os.close(fd)
            f = open(fname, 'w')
            if istask and self._knowTaskHelpIsHtml:
                f.write(helpString)
            else:
                f.write('<html><head><title>'+title+'</title></head>\n')
                f.write('<body><h3>'+title+'</h3>\n')
                f.write('<pre>\n'+helpString+'\n</pre></body></html>')
            f.close()
            irafutils.launchBrowser("file://"+fname, subj=title)
1061676
def print_help(self, short=False):
        
        header = [
            u"",
            u"NAME",
            u"  %s - %s" % (self.NAME, self.HELP["description"]),
            u"",
        ]

        synopsis = [
            u"SYNOPSIS",
            u"  %s [-h|--help|--help-rconf|--version]" % (self.invoke),
        ]
        if "synopsis" in self.HELP:
            for syn, opt in self.HELP["synopsis"]:
                if opt:
                    opt = u" [OPTIONS]"
                else:
                    opt = u""
                synopsis.append(u"  %s %s%s" % (self.invoke, syn, opt))

        synopsis.append(u"")

        options = [
            u"  -h : print short help and exit",
            u"  --help : print full help and exit",
            u"  --help-rconf : list all runtime configuration parameters",
            u"  --version : print the program name and version and exit",
            u"  -l[=FILE], --log[=FILE] : log verbose output to tmp file or FILE if specified",
            u"  -r=CONF, --runtime-configuration=CONF : apply runtime configuration CONF",
            u"  -v, --verbose : verbose output",
            u"  -vv, --very-verbose : verbose output, print date/time values",
        ]
        if "options" in self.HELP:
            for opt in self.HELP["options"]:
                options.append(u"  %s" % (opt))
        options = [u"OPTIONS"] + sorted(options) + [u""]

        parameters = []
        if ("parameters" in self.HELP) and (len(self.HELP["parameters"]) > 0):
            parameters.append(u"PARAMETERS")
            for par in self.HELP["parameters"]:
                parameters.append(u"  %s" % (par))
            parameters.append(u"")

        examples = []
        if ("examples" in self.HELP) and (len(self.HELP["examples"]) > 0):
            examples.append(u"EXAMPLES")
            for exa in self.HELP["examples"]:
                examples.append(u"  %s %s" % (self.invoke, exa))
            examples.append(u"")

        footer = [
            u"EXIT CODES",
            u"  %d : no error" % (self.NO_ERROR_EXIT_CODE),
            u"  %d : error" % (self.ERROR_EXIT_CODE),
            u"  %d : help shown, no command run" % (self.HELP_EXIT_CODE),
            u"",
            u"AUTHOR",
            u"  Alberto Pettarin, http://www.albertopettarin.it/",
            u"",
            u"REPORTING BUGS",
            u"  Please use the GitHub Issues Web page : %s" % (self.ISSUES_URL),
            u"",
            u"COPYRIGHT",
            u"  2012-2017, Alberto Pettarin and ReadBeyond Srl",
            u"  This software is available under the terms of the GNU Affero General Public License Version 3",
            u"",
            u"SEE ALSO",
            u"  Code repository  : %s" % (self.GITHUB_URL),
            u"  Documentation    : %s" % (self.DOCS_URL),
            u"  Project Web page : %s" % (self.AENEAS_URL),
            u"",
        ]

        msg = header + synopsis + options + parameters + examples
        if not short:
            msg += footer
        if self.use_sys:
            self.print_generic(u"\n".join(msg))
        return self.exit(self.HELP_EXIT_CODE)
106428
def print_help(self, prog_name, subcommand):
        
        parser = self.create_parser(prog_name, subcommand)
        parser.print_help()
951059
def print_help(self, file=None):
        
        output = file or self.stderr
        CustomStderrOptionParser.print_help(self, output)
        output.write("\nCommands:\n")
        for command_def in self.command_definitions.values():
            command_def.opt_parser.print_help(output)
            output.write("\n")
322951
final protected function printHelp()
    {
        $script = $this->parser->getScriptName();

        $this->printUsage($script);

        $this->printDescription();

        /** @var $option Option */
        foreach ($this->options as $option) {
            echo " " . $option . "\n";
        }

        echo "\n";

        $this->notify("output");

        $this->notify("shutdown");

        return 0;
    }
1138895
def main(ctx, opts, version):
    """"""
    # pylint: disable=unused-argument
    if version:
        print_version()
    elif ctx.invoked_subcommand is None:
        click.echo(ctx.get_help())
962264
def print_help(self):
        
        seen_aliases = set()
        print('-'*80)
        for cmd in sorted(self.cmds):
            if cmd not in self.builtin_cmds:
                if cmd not in seen_aliases:
                    if cmd in self.aliases:
                        seen_aliases.update(self.aliases[cmd])
                        disp = '/'.join(self.aliases[cmd])
                    else:
                        disp = cmd
                    _, parser = self.cmds[cmd]
                    usage = parser.format_usage()
                    print('%s: %s' % (disp, ' '.join(usage.split()[2:])))
        print('External CLIs: %s' % ', '.join(sorted(self.clis)))
693809
def get_help(command):
    
    assert isinstance(command, click.Command)

    def help_(self):  # pylint: disable=unused-argument
        extra = {}
        for key, value in command.context_settings.items():
            if key not in extra:
                extra[key] = value

        # Print click's help message
        with click.Context(command, info_name=command.name, parent=self.ctx, **extra) as ctx:
            click.echo(ctx.get_help(), color=ctx.color)

    help_.__name__ = 'help_%s' % command.name
    return help_
994642
def show_help(self):
        
        output = [
            'Usage %s subcommand [options] [args]' % self.prog_name,
            '',
            'Available commands:',
            '',
        ]
        for cmd in self.get_commands():
            output.append('  %s' % cmd)
        output += ['', '']
        self.stdout.write(u'\n'.join(output))
318882
def _help():
	''''''
	for task in sorted(TASKS, key=lambda x: (x.ns or '000') + x.name):
		tags = ''
		if task is DEFAULT:
			tags += '*'
		if task is SETUP:
			tags += '+'
		if task is TEARDOWN:
			tags += '-'

		print LOCALE['help_command'].format(task, tags, task.help)

		if task.aliases:
			print LOCALE['help_aliases'].format(task.aliasstr())
		if task.reqs:
			print LOCALE['help_reqs'].format(task.reqstr())
		if task.gens:
			print LOCALE['help_gens'].format(task.gens)
		if task.args or task.defaults:
			print LOCALE['help_args'].format(task.ns + task.name, task.kwargstr(), task.argstr())
986989
def _print_help(self):
        
        options = self._print_usage('\n  ', file=sys.stdout)
        if self.docstring:
            print()
            try:
                doc_string = self.docstring.format(**self._variables)
            except KeyError:
                doc_string = self.docstring
            for doc in doc_string.split('\n'):
                doc = doc.strip()
                if len(doc) > 2:
                    print(textwrap.fill(textwrap.dedent(doc).strip(),
                                        width=80, initial_indent='  ',
                                        subsequent_indent='   '))
        print()
        if options:
            print('Options:')
            width = max(len(k) for k in self._options)
            for x, t in self._options.items():
                print(self._format_option(x, t, width))
            if self._get_variable('VERSION'):
                print('{0:{1}}'.format(self._version_options[0], width), end=' ')
                print('| ' + ' | '.join(self._version_options[1:]), 'print version',
                      '(%s)' % self._get_variable('VERSION'))
            print('{0:{1}}'.format(self._help_options[0], width), end=' ')
            print('| ' + ' | '.join(self._help_options[1:]), 'print this help')
            print()
463562
def print_help(self, file: TextIO = None) -> None:
        """"""
        if file is None:
            file = sys.stderr
        print("Usage: %s [OPTIONS]" % sys.argv[0], file=file)
        print("\nOptions:\n", file=file)
        by_group = {}  # type: Dict[str, List[_Option]]
        for option in self._options.values():
            by_group.setdefault(option.group_name, []).append(option)

        for filename, o in sorted(by_group.items()):
            if filename:
                print("\n%s options:\n" % os.path.normpath(filename), file=file)
            o.sort(key=lambda option: option.name)
            for option in o:
                # Always print names with dashes in a CLI context.
                prefix = self._normalize_name(option.name)
                if option.metavar:
                    prefix += "=" + option.metavar
                description = option.help or ""
                if option.default is not None and option.default != "":
                    description += " (default %s)" % option.default
                lines = textwrap.wrap(description, 79 - 35)
                if len(prefix) > 30 or len(lines) == 0:
                    lines.insert(0, "")
                print("  --%-30s %s" % (prefix, lines[0]), file=file)
                for line in lines[1:]:
                    print("%-34s %s" % (" ", line), file=file)
        print(file=file)
568709
public function help()
    {
        echo PHP_EOL;
        $output = new Output;
        $output->write('Available Commands', [
            'color'     => 'red',
            'bold'      => true,
            'underline' => true,
        ]);
        echo PHP_EOL;

        $maxlen = 0;
        foreach ($this->supportedArgs as $key => $description) {
            $len = strlen($key);
            if ($len > $maxlen) {
                $maxlen = $len;
            }

        }

        foreach ($this->supportedArgs as $key => $description) {
            $len = strlen($key);
            $output->write(' ')
                ->write($key, ['color' => 'yellow'])
                ->write(str_repeat(' ', $maxlen - $len))
                ->write(' - ')
                ->write($description);

            echo PHP_EOL;
        }

        echo PHP_EOL;

    }
199735
def help(self, msg):
        
        commands = {}
        for handler in self.irc.handlers:
            if isinstance(handler, CommandHandler):
                for command in handler.triggers:
                    method = getattr(handler, command)
                    if hasattr(method, '__doc__') and method.__doc__:
                        commands[command] = method.__doc__.strip()
                    else:
                        commands[command] = 'No help available for command: %s' % command

        if len(msg.args) == 2:
            if msg.args[1] not in commands:
                message = 'Unknown command: %s' % msg.args[1]
            else:
                message = commands[msg.args[1]]
        else:
            message = 'Available commands: %s' % ', '.join(commands.keys())

        if msg.event == EVT_PUBLIC:
            self.irc.msg(msg.dst, message)
        elif msg.event == EVT_PRIVATE:
            self.irc.msg(msg.src, message)
        elif msg.event == EVT_NOTICE:
            self.irc.notice(msg.src, message)