#!/usr/bin/env python3
import subprocess
import argparse
import os


def get_arguments():
    parser = argparse.ArgumentParser()

    # argument groups can have their tickers combined (ie -su)
    bools = parser.add_argument_group()

    # REQUIRED string value
    parser.add_argument('url', help="The url of video or playlist desired")

    # integer value
    parser.add_argument('-m', '--max', default=136, type=int,
                        help="")

    # boolean (default=False; store_true means if ticked then args['ugly'] == True)
    bools.add_argument('-u', dest="ugly", action="store_true",
                       help="are you ugly")

    # boolean (default=True; store_false means if ticked then args['sexy'] == False)
    bools.add_argument('-s', dest="sexy", action="store_false",
                       help="are you sexy")

    args = parser.parse_args()

    return args


if __name__ == "__main__":
    # not used now
    # args = get_arguments()

    subprocess.run(
        'sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0',
        shell=True)
    subprocess.run(
        'sudo apt-add-repository https://cli.github.com/packages', shell=True)

    subprocess.run('sudo apt update', shell=True)

    subprocess.run('sudo apt-get install -y git', shell=True)
    subprocess.run('sudo apt-get install -y gh', shell=True)

    # need to decrypt personal access token
    subprocess.run('git config --global credential.helper cache', shell=True)

    subprocess.run('git clone git@github.com:slgotting/secrets.git', shell=True)

    # login to gh
    subprocess.run(
        'gpg -d -o- secrets/github-pat.gpg | gh auth login --with-token',
        shell=True)
