# coding: utf-8
"""pypel.cli, CLI interface for pypel.

THIS SOFTWARE IS UNDER BSD LICENSE.
Copyright (c) 2012-2015 Daniele Tricoli <eriol@mornie.org>

Read LICENSE for more informations.
"""

import argparse
import time
import os
import warnings

from datetime import datetime

try:
    from pygments.console import ansiformat
except ImportError:
    ansiformat = None

from pypel import get_version
try:
    from .gpg import sign, verify
    gnupg = True
except ImportError:
    gnupg = False
from .models import (delete_metadata, set_metadata, make_receipt,
                     DoesNotExist, IsADirectory, ImageNotSupported)

PYPELKEY = os.environ.get('PYPELKEY')


class Row(dict):
    """Representation of a receipt as a row for terminal output."""

    FLOAT_PRECISION = '.2'

    def __init__(self, dct=None):
        if dct is not None:
            self.update(dct)

    def len(self, key=None):
        """Return len of specified field"""