# Path: hypergolix/exceptions.py
# class ConfigError(HypergolixException, RuntimeError):
#     ''' This exception (or a subclass thereof) is raised for all failed
#     operations with configuration.
#     '''
#     pass
# 
# Path: hypergolix/exceptions.py
# class ConfigIncomplete(ConfigError):
#     ''' This exception is raised when attempting to load an incomplete
#     configuration.
#     '''
#     pass
# 
# Path: hypergolix/exceptions.py
# class ConfigMissing(ConfigError, FileNotFoundError):
#     ''' This exception is raised when attempting to load an incomplete
#     configuration.
#     '''
#     pass


import pathlib
import collections
import copy
import webbrowser
import yaml
import inspect
import os
import warnings
import logging
from golix import Ghid
from golix import Secret
from .exceptions import ConfigError
from .exceptions import ConfigIncomplete
from .exceptions import ConfigMissing
        try:
            webbrowser.open(reg_address, new=2)
            
        except Exception:
            print(
                'Failed to open web browser for registration.\n' +
                'Please navigate to this address and click "register":\n' +
                _format_blockstr(reg_address)
            )
            
        else:
            print(
                'Please complete registration in your browser window.\n' +
                'If no page was opened, navigate to this address and\n' +
                'click "register":\n' +
                _format_blockstr(reg_address)
            )


def handle_args(args):
    ''' Performs all needed actions on the passed command args.
    '''
    _typecast_remotes(args)
    
    # If no config root was passed as an argument, search for one, and if we
    # can't find the config, create a new one
    if args.cfg_root is None:
        try:
            config = Config.find()
        

# Path: hypergolix/exceptions.py
# class ConfigError(HypergolixException, RuntimeError):
#     ''' This exception (or a subclass thereof) is raised for all failed
#     operations with configuration.
#     '''
#     pass
# 
# Path: hypergolix/exceptions.py
# class ConfigIncomplete(ConfigError):
#     ''' This exception is raised when attempting to load an incomplete
#     configuration.
#     '''
#     pass
# 
# Path: hypergolix/exceptions.py
# class ConfigMissing(ConfigError, FileNotFoundError):
#     ''' This exception is raised when attempting to load an incomplete
#     configuration.
#     '''
#     pass


# Path: hypergolix/config.py
import pathlib
import collections
import copy
import webbrowser
import yaml
import inspect
import os
import warnings
import logging
from golix import Ghid
from golix import Secret
from .exceptions import ConfigError
from .exceptions import ConfigIncomplete
from .exceptions import ConfigMissing

        try:
            webbrowser.open(reg_address, new=2)
            
        except Exception:
            print(
                'Failed to open web browser for registration.\n' +
                'Please navigate to this address and click "register":\n' +
                _format_blockstr(reg_address)
            )
            
        else:
            print(
                'Please complete registration in your browser window.\n' +
                'If no page was opened, navigate to this address and\n' +
                'click "register":\n' +
                _format_blockstr(reg_address)
            )


def handle_args(args):
    ''' Performs all needed actions on the passed command args.
    '''
    _typecast_remotes(args)
    
    # If no config root was passed as an argument, search for one, and if we
    # can't find the config, create a new one
    if args.cfg_root is None:
        try:
            config = Config.find()
        

        except ConfigMissing: