(version)
Update your Bashhub installation
Update your Bashhub installation
Update your Bashhub installation
def update(version):
    """Update your Bashhub installation"""

    if version != '':
        github = "https://github.com/rcaloras/bashhub-client/archive/{0}.tar.gz".format(
            version)
        response = requests.get(github)
        if response.status_code != 200:
            click.echo("Invalid version number {0}".format(version))
            sys.exit(1)

    query_param = '?version={0}'.format(version) if version else ''
    url = 'https://bashhub.com/setup' + query_param
    response = requests.get(url, stream=True)
    filename = 'update-bashhub.sh'
    with open(filename, 'wb') as out_file:
        shutil.copyfileobj(response.raw, out_file)

    shell_command = "bash -e {0} {1}".format(filename, version)
    subprocess.call(shell_command, shell=True)
    os.remove(filename)
def update ( version ) : if version != '' : github = "https://github.com/rcaloras/bashhub-client/archive/{0}.tar.gz" . format ( version ) response = requests . get ( github ) if response . status_code != 200 : click . echo ( "Invalid version number {0}" . format ( version ) ) sys . exit ( 1 ) query_param = '?version={0}' . format ( version ) if version else '' url = 'https://bashhub.com/setup' + query_param response = requests . get ( url , stream = True ) filename = 'update-bashhub.sh' with open ( filename , 'wb' ) as out_file : shutil . copyfileobj ( response . raw , out_file ) shell_command = "bash -e {0} {1}" . format ( filename , version ) subprocess . call ( shell_command , shell = True ) os . remove ( filename )