src/streamlink_cli/main.py
def setup_plugin_options(session, plugin):
    """Sets Streamlink plugin options."""
    pname = plugin.module
    required = OrderedDict({})
    for parg in plugin.arguments:
        if parg.options.get("help") != argparse.SUPPRESS:
            if parg.required:
                required[parg.name] = parg
            value = getattr(args, parg.namespace_dest(pname))
            session.set_plugin_option(pname, parg.dest, value)
            # if the value is set, check to see if any of the required arguments are not set
            if parg.required or value:
                try:
                    for rparg in plugin.arguments.requires(parg.name):
                        required[rparg.name] = rparg
                except RuntimeError:
                    console.logger.error("{0} plugin has a configuration error and the arguments "
                                         "cannot be parsed".format(pname))
                    break
    if required:
        for req in required.values():
            if not session.get_plugin_option(pname, req.dest):
                prompt = req.prompt or "Enter {0} {1}".format(pname, req.name)
                session.set_plugin_option(pname, req.dest,
                                          console.askpass(prompt + ": ")
                                          if req.sensitive else
                                          console.ask(prompt + ": "))
def setup_plugin_options(session, plugin):
    """Sets Streamlink plugin options."""
    pname = plugin.module
    required = OrderedDict({})
    for parg in plugin.arguments:
        if parg.options.get("help") != argparse.SUPPRESS:
            if parg.required:
                required[parg.name] = parg
            value = getattr(args, parg.namespace_dest(pname))
            session.set_plugin_option(pname, parg.dest, value)
            # if the value is set, check to see if any of the required arguments are not set
            if parg.required or value:
                try:
                    for rparg in plugin.arguments.requires(parg.name):
                        required[rparg.name] = rparg
                except RuntimeError:
                    console.logger.error("{0} plugin has a configuration error and the arguments "
                                         "cannot be parsed".format(pname))
                    break
    if required:
        for req in required.values():
            if not session.get_plugin_option(pname, req.dest):
                prompt = req.prompt or "Enter {0} {1}".format(pname, req.name)
                session.set_plugin_option(pname, req.dest,
                                          console.askpass(prompt + ": ")
                                          if req.sensitive else
                                          console.ask(prompt + ": "))
Sets Streamlink plugin options.