# Path: alertaclient/auth/utils.py
# def get_token(endpoint):
#     try:
#         info = netrc(NETRC_FILE)
#     except Exception:
#         return
#     auth = info.authenticators(machine(endpoint))
#     if auth is not None:
#         _, _, password = auth
#         return password


import click
from alertaclient.auth.token import Jwt
from alertaclient.auth.utils import get_token



@click.command('token', short_help='Display current auth token')
@click.option('--decode', '-D', is_flag=True, help='Decode auth token.')
@click.pass_obj
def cli(obj, decode):
    """Display the auth token for logged in user, with option to decode it."""
    client = obj['client']

# Path: alertaclient/auth/utils.py
# def get_token(endpoint):
#     try:
#         info = netrc(NETRC_FILE)
#     except Exception:
#         return
#     auth = info.authenticators(machine(endpoint))
#     if auth is not None:
#         _, _, password = auth
#         return password


# Path: alertaclient/commands/cmd_token.py
import click
from alertaclient.auth.token import Jwt
from alertaclient.auth.utils import get_token




@click.command('token', short_help='Display current auth token')
@click.option('--decode', '-D', is_flag=True, help='Decode auth token.')
@click.pass_obj
def cli(obj, decode):
    """Display the auth token for logged in user, with option to decode it."""
    client = obj['client']

    token = get_token(client.endpoint)