Example #1
0
def newPopulatedConfigInteractive():
    config = configparser.ConfigParser()
    config.add_section(CANVAS_SECTION)
    config.add_section(GITHUB_SECTION)

    i = itv.promptSelect('Configure Canvas token?', ['n'], default='y')
    if i == 'y':
        itv.output('You can generate a new Canvas token by going to your '
                'Canvas Profile -> Settings -> Approved Integrations '
                'and clicking on "+New Access Token"')
        canvasToken = itv.promptInput('Enter Canvas auth token')
        config.set(CANVAS_SECTION, CANVAS_TOKEN, canvasToken)

    i = itv.promptSelect('Configure GitHub token?', ['n'], default='y')
    if i == 'y':
        githubToken = itv.promptInput('Enter GitHub auth token')
        config.set(GITHUB_SECTION, GITHUB_TOKEN, githubToken)

    return config
Example #2
0
def createConfigInteractive():
    try:
        itv.output('This script will help you create your Boatswain config.')
        path = itv.promptValidate('Enter Boatswain config file location', 
                itv.newFileValidator(), default=DEFAULT_INI_PATH)
        
        config = newPopulatedConfigInteractive()
        config.write(open(path, 'w+'))

        itv.output('Boatswain config file created at {}'.format(path))

    except EOFError:
        itv.output()
        itv.output('Quitting intercative Boatswaing config creator...')
        return
Example #3
0
def main():
    itv.output('Welcome to Boatswain.')
    createConfigInteractive()