Describe an option
435134
def opt(self, name, help, abbrev=None,
            type=None, choices=None, metavar=None, nargs=None):
        """"""
        kw = dict(help=help, type=type, choices=choices, metavar=metavar,
                  nargs=nargs)
        default = self.argdict[name]
        if default is not NODEFAULT:
            kw['default'] = default
            kw['metavar'] = metavar or str_choices(choices) or str(default)
        abbrev = abbrev or '-' + name[0]
        abbrevs = set(args[0] for args, kw in self.all_arguments)
        longname = '--' + name.replace('_', '-')
        if abbrev == '-h' or abbrev in abbrevs:
            # avoid conflicts with predefined abbreviations
            self._add(name, longname, **kw)
        else:
            self._add(name, abbrev, longname, **kw)
685454
def command_with_options(self):
        """"""
        if 'args' in self.config:
            return ' '.join((self.command, self.config['args']))
        return self.command
314426
Option toOption() {
        DefaultOptionBuilder oBuilder = new DefaultOptionBuilder();

        oBuilder.withShortName(option).withDescription(description).withRequired(required);

        if (longOptionName != null) {
            oBuilder.withLongName(longOptionName);
        }

        if (hasArgs) {
            ArgumentBuilder aBuilder = new ArgumentBuilder();

            if (argName != null) {
                aBuilder.withName(argName);
            }

            if (argsAreOptional) {
                aBuilder.withMinimum(0);
            }

            if (argsCount != null) {
                aBuilder.withMaximum(argsCount);
            } else {
                aBuilder.withMaximum(1);
            }

            if (argsValueSeparator != null && argsValueSeparator.length() != 0) {
                aBuilder.withInitialSeparator(argsValueSeparator.charAt(0));
                aBuilder.withSubsequentSeparator(argsValueSeparator.charAt(0));
            }
            oBuilder.withArgument(aBuilder.create());
        }

        return oBuilder.create();
    }
207711
function option(name, type) {
  if (name[TYPICAL_TYPE]) {
    type = name;
    name = `${type.name}Option`;
  }

  /* istanbul ignore else */
  if (__DEV__) {
    assert(typeof name === 'string', `option()'s name must be a string`);
    assert(type[TYPICAL_TYPE], `option()'s type must be a type`);
  }

  const api = this;

  function Option(value, context) {
    if (Context.isRequired(context)) {
      return Context.with(value, Option, context, api);
    }

    return value == null ? context.toValue(value) : type(value, context);
  }

  return decorate(Option, name, option, type);
}
1272133
function productOptionInformation( $objectAttribute, $optionID, $productItem )
    {
        $multioption = $objectAttribute->attribute( 'content' );

        foreach ( $multioption->attribute( 'multioption_list' ) as $multioptionElement )
        {
            foreach ( $multioptionElement['optionlist'] as $option )
            {
                if ( $option['option_id'] != $optionID )
                    continue;

                return array( 'id' => $option['option_id'],
                              'name' => $multioptionElement['name'],
                              'value' => $option['value'],
                              'additional_price' => $option['additional_price'] );
            }
        }
    }
470435
String getOption(String[] options, int index) {
        if ((options != null) && (options.length > index)) {
            return options[index];
        }
        return null;
    }
421942
def info(self):
        """"""
        if self.descriptions is None:
            choice_list = ['"{}"'.format(choice) for choice in self.choices]
        else:
            choice_list = [
                '"{}" ({})'.format(choice, self.descriptions[choice])
                for choice in self.choices
            ]
        if len(self.choices) == 2:
            return 'either {} or {}'.format(choice_list[0], choice_list[1])
        return 'any of {}'.format(', '.join(choice_list))
703003
def describe_ingredient(self):
        
        resp = random.choice(ingredients)
        if random.random() < .2:
            resp = random.choice(foodqualities) + " " + resp
        if random.random() < .2:
            resp += " with " + self.describe_additive()
        return resp
514887
function (obj, pred) {
      var props = keys(obj);
      for (var k = 0, len = props.length; k < len; k++) {
        var i = props[k];
        var x = obj[i];
        if (pred(x, i, obj)) {
          return Option.some(x);
        }
      }
      return Option.none();
    }
1349690
def _format_option(opt):
    """"""
    opt = _get_help_record(opt)

    yield '.. option:: {}'.format(opt[0])
    if opt[1]:
        yield ''
        for line in statemachine.string2lines(
                opt[1], tab_width=4, convert_whitespace=True):
            yield _indent(line)
194459
def choice(opts, default=1, text='Please make a choice.'):
    
    opts_len = len(opts)
    opts_enum = enumerate(opts, 1)
    opts = list(opts)

    for key, opt in opts_enum:
        click.echo('[{k}] {o}'.format(k=key, o=opt[1] if isinstance(opt, tuple) else opt))

    click.echo('-' * 12)
    opt = click.prompt(text, default, type=click.IntRange(1, opts_len))
    opt = opts[opt - 1]
    return opt[0] if isinstance(opt, tuple) else opt
851184
function unknownOption (flag, type = 'option') {
  if (this._allowUnknownOption) return

  logger.error()
  logger.error(`  error: unknown ${type}:`, flag)
  logger.error()
  this.outputHelp()
  util.exit(1)
}
591142
def _choose_from_list(options, question):
    """"""
    message = ""
    for index, value in enumerate(options):
        message += "[{}] {}\n".format(index, value)
    message += "\n" + question

    def valid(n):
        if int(n) not in range(len(options)):
            raise ValueError("Not a valid option.")
        else:
            return int(n)

    prompt(message, validate=valid, key="answer")
    return env.answer
1257456
def option(name, help=""):
    """"""
    def decorator(func):
        options = getattr(func, "options", [])
        _option = Param(name, help)
        # Insert at the beginning so the apparent order is preserved
        options.insert(0, _option)
        func.options = options
        return func

    return decorator
1314086
def option(opts, *args)
      long_opt_symbol = long_opt_symbol(args)
      args += Array(OptionsHelp::TEXT[long_opt_symbol])
      opts.on(*args) do |arg|
        @options[long_opt_symbol] = arg
        yield arg if block_given?
      end
    end
1258098
function choice(...alternatives) {
    const altsDefs = _.map(alternatives, alt => {
        return new Flat({ definition: toDefinition(alt) })
    })

    const orgTextParts = _.map(alternatives, toOriginalText)

    const definition = new Alternation({ definition: altsDefs })
    definition.orgText = `choice(${orgTextParts.join(", ")})`

    return {
        toRule: toRule,
        definition: definition
    }
}
369466
function maybe (options) {
  if (Math.round(Math.random())) {
    return options.fn(this);
  } else {
    return options.inverse(this);
  }
}