Format this diagnostic for display. The options argument takes
        Diagnostic.Display* flags, which can be combined using bitwise OR. If
        the options argument is not provided, the default display options will
        be used.
354467
def format(self, options=None):
        
        if options is None:
            options = conf.lib.clang_defaultDiagnosticDisplayOptions()
        if options & ~Diagnostic._FormatOptionsMask:
            raise ValueError('Invalid format options')
        formatted = conf.lib.clang_formatDiagnostic(self, options)
        return str(conf.lib.clang_getCString(formatted))
1048938
function Option(flags, description) {
  this.flags = flags;
  this.required = ~flags.indexOf('<');
  this.optional = ~flags.indexOf('[');
  this.bool = !~flags.indexOf('-no-');
  flags = flags.split(/[ ,|]+/);
  if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
  this.long = flags.shift();
  this.description = description || '';
}
62163
public void displayMenu() {
        while (true) {
            ConsoleMenu.println("");
            ConsoleMenu.println("Menu Options");

            final int size = menu.size();

            displayMenu(size);

            int opt;

            do {
                opt = ConsoleMenu.getInt("Enter your choice:", -1);
            } while ((opt <= 0 || opt > methods.size()) && opt != EXIT_CODE);

            if (opt == EXIT_CODE) {
                callTearDownIfRequired();
                return;
            }

            callMenuOption(opt);
        }
    }
497095
def _display_runner(rows, labels, title, display=_DEFAULT_DISPLAY):
    '''
    
    '''
    if display:
        net_runner_opts = _get_net_runner_opts()
        if net_runner_opts.get('outputter') == 'table':
            ret = salt.output.out_format({'rows': rows, 'labels': labels},
                                         'table',
                                         __opts__,
                                         title=title,
                                         rows_key='rows',
                                         labels_key='labels')
        else:
            ret = salt.output.out_format(rows,
                                         net_runner_opts.get('outputter'),
                                         __opts__)
        print(ret)
    else:
        return rows
1321661
def _arg2opt(arg):
    '''
    
    '''
    res = [o for o, a in option_toggles.items() if a == arg]
    res += [o for o, a in option_flags.items() if a == arg]
    return res[0] if res else None
1341186
def opt_display(self, display):
        
        key = get_enum_key(display, DISPLAYS)
        if key is not None:
            self.conf["display"] = key
            self.display = DISPLAYS[key]
            print("Set display %r" % key)
        else:
            print("Unknown display %r" % display)
565044
def complete_opt_display(self, text, *_):
        
        return [t + " " for t in DISPLAYS if t.startswith(text)]
1356484
def display_columns config={}
      prompt = config[:prompt] || "Choose: "
      require 'canis/core/util/rcommandwindow'
      layout = { :height => 5, :width => Ncurses.COLS-0, :top => Ncurses.LINES-6, :left => 0 }
      rc = CommandWindow.new nil, :layout => layout, :box => true, :title => config[:title] || "Menu"
      w = rc.window
      r = 4
      c = 1
      color = $datacolor
      begin
        menu = @options
        $log.debug " DISP MENU "
        ret = 0
        len = 80
        while true
          h = {}
          valid = []
          labels = []
          menu.each{ |item|
            if item.respond_to? :hotkey
              hk = item.hotkey.to_s
            else
              raise ArgumentError, "Promptmenu needs hotkey or mnemonic"
            end
            # 187compat 2013-03-20 - 19:00 throws up
            labels << "%c. %s " % [ hk.getbyte(0), item.label ]
            h[hk] = item
            valid << hk
          }
          #$log.debug " valid are #{valid} "
          color = $datacolor
          #print_this(win, str, color, r, c)
          rc.display_menu labels, :indexing => :custom
          ch=w.getchar()
          rc.clear
          #$log.debug " got ch #{ch} "
          next if ch < 0 or ch > 255
          if ch == 3 || ch == ?\C-g.getbyte(0)
            clear_this w, r, c, color, len
            print_this(w, "Aborted.", color, r,c)
            break
          end
          ch = ch.chr
          index = valid.index ch
          if index.nil?
            clear_this w, r, c, color, len
            print_this(w, "Not valid. Valid are #{valid}. C-c/C-g to abort.", color, r,c)
            sleep 1
            next
          end
          #$log.debug " index is #{index} "
          item = h[ch]
          # I don;t think this even shows now, its useless
          if item.respond_to? :desc
            desc = item.desc
            #desc ||= "Could not find desc for #{ch} "
            desc ||= ""
            clear_this w, r, c, color, len
            print_this(w, desc, color, r,c)
          end
          action = item.action
          case action
            #when Array
          when PromptMenu
            # submenu
            menu = action.options
            title = rc.title
            rc.title title +" => " + action.text # set title of window to submenu
          when Proc
            #rc.destroy
            ##bottom needs to be refreshed somehow
            #FFI::NCurses.ungetch ?j
            rc.hide
            ret = action.call
            break
          when Symbol
            if @caller.respond_to?(action, true)
              rc.hide
              $log.debug "XXX:  IO caller responds to action #{action} "
              ret = @caller.send(action)
            elsif @caller.respond_to?(:execute_this, true)
              rc.hide
              ret = @caller.send(:execute_this, action)
            else
              alert "PromptMenu: unidentified action #{action} for #{@caller.class} "
              raise "PromptMenu: unidentified action #{action} for #{@caller.class} "
            end

            break
          else 
            $log.debug " Unidentified flying class #{action.class} "
            break
          end
        end # while
      ensure
        rc.destroy
        rc = nil
      end
    end
1257200
def displayformat(codes=[], fg=None, bg=None):
        """"""
        if isinstance(codes, basestring):
            codes = [codes]
        else:
            codes = list(codes)
        for code in codes:
            if code not in Magic.DISPLAY.keys():
                raise ValueError("'%s' not a valid display value" % code)
        for color in (fg, bg):
            if color != None:
                if color not in Magic.COLORS.keys():
                    raise ValueError("'%s' not a valid color" % color)
        return [codes, fg, bg]
877796
def display_info(args):
    
    puts('\nTarbell: Simple web publishing\n')

    puts('Usage: {0}\n'.format(colored.cyan('tarbell <command>')))
    puts('Commands:\n')
    for command in Command.all_commands():
        usage = command.usage or command.name
        help = command.help or ''
        puts('{0} {1}'.format(
            colored.yellow('{0: <37}'.format(usage)),
            split_sentences(help, 37)
        ))
    puts("")

    settings = Settings()
    if settings.file_missing:
        puts('---\n{0}: {1}'.format(
            colored.red("Warning"),
            "No Tarbell configuration found. Run:"
        ))
        puts('\n{0}'.format(
            colored.green("tarbell configure")
        ))
        puts('\n{0}\n---'.format(
            "to configure Tarbell."
        ))
658549
def display(self, codes=[], fg=None, bg=None):
        
        codes, fg, bg = Magic.displayformat(codes, fg, bg)
        color = 0
        for c in codes:
            try:
                f = getattr(self, '_display_' + c)
                out = f()
                if out: color |= out
            except AttributeError:
                pass
        cfg, cfgi, cbg, cbgi = self._split_attributes(
                          self._get_console_info()['attributes'])
        if self.reverse_input:
            cfg, cbg = (cbg // 0x10), (cfg * 0x10)
            cfgi, cbgi = (cbgi // 0x10), (cfgi * 0x10)
        if fg != None:
            color |= self.FG[fg]
            self.real_fg = self.FG[fg]
        else: color |= cfg
        if bg != None:
            color |= self.BG[bg]
        else: color |= cbg
        color |= (cfgi | cbgi)
        fg, fgi, bg, bgi = self._split_attributes(color)
        if self.dim_output:
            # intense black
            fg = 0
            fgi = self.FG_INTENSITY
        if self.reverse_output:
            fg, bg = (bg // 0x10), (fg * 0x10)
            fgi, bgi = (bgi // 0x10), (fgi * 0x10)
            self.reverse_input = True
        if self.hidden_output:
            fg = (bg // 0x10)
            fgi = (bgi // 0x10)
        self._set_attributes(fg | fgi | bg | bgi)
865256
def format_cli(self, value):
        
        if value is None or (self.type == 'flag' and not value):
            return None
        pass_as_bits = text_type(self.pass_as or self.default_pass_as).split()
        env = dict(name=self.name, value=value, v=value)
        return [bit.format(**env) for bit in pass_as_bits]
982315
def _ParseInformationalOptions(self, options):
    
    self._debug_mode = getattr(options, 'debug', False)
    self._quiet_mode = getattr(options, 'quiet', False)

    if self._debug_mode and self._quiet_mode:
      logger.warning(
          'Cannot use debug and quiet mode at the same time, defaulting to '
          'debug output.')
1240043
private static void safeFormatTo(Formattable value, StringBuilder out, FormatOptions options) {
    // Only care about 3 specific flags for Formattable.
    int formatFlags = options.getFlags() & (FLAG_LEFT_ALIGN | FLAG_UPPER_CASE | FLAG_SHOW_ALT_FORM);
    if (formatFlags != 0) {
      // TODO: Maybe re-order the options flags to make this step easier or use a lookup table.
      // Note that reordering flags would require a rethink of how they are parsed.
      formatFlags = ((formatFlags & FLAG_LEFT_ALIGN) != 0 ? FormattableFlags.LEFT_JUSTIFY : 0)
          | ((formatFlags & FLAG_UPPER_CASE) != 0 ? FormattableFlags.UPPERCASE : 0)
          | ((formatFlags & FLAG_SHOW_ALT_FORM) != 0 ? FormattableFlags.ALTERNATE : 0);
    }
    // We may need to undo an arbitrary amount of appending if there is an error.
    int originalLength = out.length();
    Formatter formatter = new Formatter(out, FORMAT_LOCALE);
    try {
      value.formatTo(formatter, formatFlags, options.getWidth(), options.getPrecision());
    } catch (RuntimeException e) {
      out.setLength(originalLength);
      // We only use a StringBuilder to create the Formatter instance.
      try {
        formatter.out().append(getErrorString(value, e));
      } catch (IOException impossible) { }
    }
  }
575453
private static void display(String format, Object... args) {
        System.out.println(MessageFormatter.arrayFormat(format, args).getMessage());
    }
226592
def set_format_options(fmt, format_options):
    """"""
    if not format_options:
        return

    for opt in format_options:
        try:
            key, value = opt.split('=')
        except ValueError:
            raise ValueError("Format options are expected to be of the form key=value, not '{}'".format(opt))

        if key not in _VALID_FORMAT_OPTIONS:
            raise ValueError("'{}' is not a valid format option. Expected one of '{}'"
                             .format(key, "', '".join(_VALID_FORMAT_OPTIONS)))

        if key in _BINARY_FORMAT_OPTIONS:
            value = str2bool(value)

        fmt[key] = value
1279908
def _print_message(self, flag_message=None, color=None, padding=None,
                       reverse=False):
        
        if flag_message:
            flag_message = stdout_encode(flag(flag_message,
                                              color=color if self.pretty else None,
                                              show=False))
            if not reverse:
                print(padd(flag_message, padding),
                      self.format_messages(self.message))
            else:
                print(self.format_messages(self.message),
                      padd(flag_message, padding))
        else:
            print(self.format_messages(self.message))
        self.message = []