# Path: gg/utils.py
# def error_out(msg, raise_abort=True):
#     click.echo(click.style(msg, fg="red"))
#     if raise_abort:
#         raise click.Abort
# 
# def success_out(msg):
#     click.echo(click.style(msg, fg="green"))
# 
# def info_out(msg):
#     click.echo(msg)
# 
# Path: gg/state.py
# def read(configfile):
#     with open(configfile, "r") as f:
#         return json.load(f)
# 
# def update(configfile, data):
#     state = read(configfile)
#     state.update(data)
#     write(configfile, state)
# 
# def remove(configfile, key):
#     state = read(configfile)
#     del state[key]
#     write(configfile, state)
# 
# Path: gg/main.py
# DEFAULT_CONFIGFILE = os.path.expanduser("~/.gg.json")
# class Config:
#     def __init__(self):
# def cli(config, configfile, verbose):


import json
import getpass
import urllib.parse
import click
import requests
from gg.utils import error_out, success_out, info_out
from gg.state import read, update, remove
from gg.main import cli, pass_config
                {
                    "BUGZILLA": {
                        "bugzilla_url": config.bugzilla_url,
                        "api_key": api_key,
                        # "login": login,
                    }
                },
            )
            success_out("Yay! It worked!")
    else:
        error_out(f"Failed - {response.status_code} ({response.json()})")


@bugzilla.command()
@pass_config
def logout(config):
    """Remove and forget your Bugzilla credentials"""
    state = read(config.configfile)
    if state.get("BUGZILLA"):
        remove(config.configfile, "BUGZILLA")
        success_out("Forgotten")
    else:
        error_out("No stored Bugzilla credentials")


def get_summary(config, bugnumber):
    params = {"ids": bugnumber, "include_fields": "summary,id"}
    # If this function is called from a plugin, we don't have
    # config.bugzilla_url this time.
    base_url = getattr(config, "bugzilla_url", BUGZILLA_URL)

# Path: gg/utils.py
# def error_out(msg, raise_abort=True):
#     click.echo(click.style(msg, fg="red"))
#     if raise_abort:
#         raise click.Abort
# 
# def success_out(msg):
#     click.echo(click.style(msg, fg="green"))
# 
# def info_out(msg):
#     click.echo(msg)
# 
# Path: gg/state.py
# def read(configfile):
#     with open(configfile, "r") as f:
#         return json.load(f)
# 
# def update(configfile, data):
#     state = read(configfile)
#     state.update(data)
#     write(configfile, state)
# 
# def remove(configfile, key):
#     state = read(configfile)
#     del state[key]
#     write(configfile, state)
# 
# Path: gg/main.py
# DEFAULT_CONFIGFILE = os.path.expanduser("~/.gg.json")
# class Config:
#     def __init__(self):
# def cli(config, configfile, verbose):


# Path: gg/builtins/bugzilla.py
import json
import getpass
import urllib.parse
import click
import requests
from gg.utils import error_out, success_out, info_out
from gg.state import read, update, remove
from gg.main import cli, pass_config

                {
                    "BUGZILLA": {
                        "bugzilla_url": config.bugzilla_url,
                        "api_key": api_key,
                        # "login": login,
                    }
                },
            )
            success_out("Yay! It worked!")
    else:
        error_out(f"Failed - {response.status_code} ({response.json()})")


@bugzilla.command()
@pass_config
def logout(config):
    """Remove and forget your Bugzilla credentials"""
    state = read(config.configfile)
    if state.get("BUGZILLA"):
        remove(config.configfile, "BUGZILLA")
        success_out("Forgotten")
    else:
        error_out("No stored Bugzilla credentials")


def get_summary(config, bugnumber):
    params = {"ids": bugnumber, "include_fields": "summary,id"}
    # If this function is called from a plugin, we don't have
    # config.bugzilla_url this time.
    base_url = getattr(config, "bugzilla_url", BUGZILLA_URL)

    state = read(config.configfile)