How to use the questionary.prompt function in questionary

To help you get started, we’ve selected a few questionary examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github riffnshred / nhl-led-scoreboard / src / nhl_setup / nhl_setup.py View on Github external
'qmark': qmark,
            'message' : "Select the division to display",
            'choices' : ['atlantic','metropolitan','central','pacific'],
            'default' : get_default_value(default_config,['boards','standings','divisions'],"string") or 'atlantic'
        },
        {
            'type' : 'list',
            'name' : 'conference',
            'qmark': qmark,
            'message' : "Select the conference to display",
            'choices' : ['eastern','western'],
            'default' : get_default_value(default_config,['boards','standings','conference'],"string") or 'eastern'
        }
    ]

    standings_answers = prompt(standings_questions,style=custom_style_dope)

    boards_config['boards'].update(standings = standings_answers)

    clock_questions = [
        {
            'type': 'input',
            'name': 'duration',
            'qmark': qmark,
            'message': 'Duration clock is shown',
            'validate': lambda val: True if val.isdecimal() and int(val) >= 1 else 'Must be a number and greater or equal than 1',
            'filter': lambda val: int(val),
            'default': get_default_value(default_config,['boards','clock','duration'],"int") or '60'
        },
        {
            'type': 'confirm',
            'name': 'hide_indicator',
github riffnshred / nhl-led-scoreboard / src / nhl_setup / nhl_setup.py View on Github external
'qmark': qmark,
            'message': 'Show preferred teams only? (Show only your preferred team or all games of the day)',
            'default': get_default_value(default_config,['boards','scoreticker','preferred_teams_only'],"bool")
        },
        {
            'type': 'input',
            'name': 'rotation_rate',
            'qmark': qmark,
            'message': 'Board rotation rate? (How often do you want to rotate the games shown)',
            'validate': lambda val: True if val.isdecimal() and int(val) >= 1 else 'Must be a number and greater or equal than 1',
            'filter': lambda val: int(val),
            'default': get_default_value(default_config,['boards','scoreticker','rotation_rate'],"int") or '5'
        }
    ]

    scoreticker_answers = prompt(scoreticker_questions,style=custom_style_dope)
    
    boards_config['boards']['scoreticker'] = scoreticker_answers

    standings_questions = [
        {
            'type': 'confirm',
            'name': 'preferred_standings_only',
            'qmark': qmark,
            'message': 'Show preferred standings only? (Show all standings or your preferred division and conference)',
            'default': get_default_value(default_config,['boards','standings','preferred_standings_only'],"bool")
        },
        {
            'type' : 'list',
            'name' : 'standing_type',
            'qmark': qmark,
            'message' : "Select the type of standings to display",
github riffnshred / nhl-led-scoreboard / src / nhl_setup / nhl_setup.py View on Github external
sbio_config = {'sbio':{'dimmer':{},'pushbutton':{}}}

    #Get default config
    sbio_default = get_default_value(default_config,['sbio'],"string")

    dimmer_enabled = [
        {
            'type': 'confirm',
            'name': 'enabled',
            'qmark': qmark,
            'message': 'Use dimmer',
            'default': get_default_value(default_config,['sbio','dimmer','enabled'],"bool")  
        }
    ]

    use_dimmer = prompt(dimmer_enabled,style=custom_style_dope)
    if use_dimmer['enabled'] or not sbio_default:
        sbio_config['sbio']['dimmer'].update(enabled = True)

        #Get all of the settings for the dimmer from the user
        dimmer_questions = [
            {
                'type' : 'list',
                'name' : 'source',
                'qmark': qmark,
                'message' : "Select source of dimmer, software (uses your IP to find sunrise/sunset) or hardware (a sensor attached)",
                'choices' : ['software','hardware'],
                'default' : get_default_value(default_config,['sbio','dimmer','source'],"string") or 'software'
            },
            {
                'type': 'input',
                'name': 'frequency',
github riffnshred / nhl-led-scoreboard / src / nhl_setup / nhl_setup.py View on Github external
if canada_prov_index == 0:
        message = "Select your covid19 Canadian provinces:"
    else:
        message = "Select a Canadian province for Covid19 board"

    canada_prov_prompt = [
        {
            'type': 'list',
            'name': 'canada_prov',
            'qmark': qmark,
            'message': message,
            'choices': choices,
        }
    ]
    answers = prompt(canada_prov_prompt,style=custom_style_dope)
    return answers['canada_prov']
github tmbo / questionary / examples / password.py View on Github external
def ask_dictstyle(**kwargs):
    questions = [
        {"type": "password", "message": "Enter your git password", "name": "password"}
    ]

    return prompt(questions, style=custom_style_dope, **kwargs)
github riffnshred / nhl-led-scoreboard / src / nhl_setup / nhl_setup.py View on Github external
nhl_config.update(preferences)

    goal_animations_dict ={'goal_animations':{}}

    questions = [

        {
            'type': 'confirm',
            'name': 'pref_team_only',
            'qmark': qmark,
            'message': 'Do you want goal animations for only preferred team?',
            'default': get_default_value(default_config,['goal_animations','pref_team_only'],"bool")
        },
    ]

    goal_animation_answer = prompt(questions,style=custom_style_dope)
    goal_animations_dict['goal_animations'].update(goal_animation_answer)

    nhl_config.update(goal_animations_dict)

    states = ['off_day','scheduled','intermission','post_game']
    state_index = 0
    temp_dict = {}

    while state_index < len(states):
        board_list = ['clock','scoreticker','standings','team_summary','covid_19']
        
        boards_selected = []
        board = None
        select_board = True

        while select_board:
github riffnshred / nhl-led-scoreboard / src / nhl_setup / nhl_setup.py View on Github external
def get_board(state,boardlist,qmark):
    
    message ='Select a board to display for ' + state 
    states_prompt = [
        {
            'type': 'list',
            'name': 'board',
            'qmark': qmark,
            'message': message,
            'choices': boardlist,
        }
    ]
    answers = prompt(states_prompt,style=custom_style_dope)
    return answers['board']
github IKNL / vantage / vantage6 / cli / configuration_wizard.py View on Github external
},
        {
            "type": "text",
            "name": "api_path",
            "message": "Path of the api:",
            "default": "/api"
        },
        {
            "type": "text",
            "name": "task_dir",
            "message": "Task directory path:",
            "default": str(dirs["data"])
        }
    ])

    config["databases"] = q.prompt([
        {
            "type": "text",
            "name": "default",
            "message": "Default database path:"
        }
    ])
    i = 1
    while q.confirm("Do you want to add another database?").ask():
        q2 = q.prompt([
            {
                "type": "text",
                "name": "label",
                "message": "Enter the label for the database:",
                "default": f"database_{i}"
            },
            {
github webscopeio / license.sh / license_sh / commands / __init__.py View on Github external
"JSON",
    ]

    questions = [
        {
            "type": "checkbox",
            "qmark": "📋",
            "message": "Select licenses which are OK to be used for your project",
            "name": "whitelist",
            "choices": [
                {"name": license, "checked": license in whitelist}
                for license in default_licenses
            ],
        },
    ]
    answers = questionary.prompt(questions)

    if "whitelist" in answers:
        config["whitelist"] = answers["whitelist"]

    if write_config(path, config):
        print("Successfully generated .license-sh.json file")