List bitstreams of an object::

    usage: cdstar ls [options] <URL>

    options:
        -t  sort by modification time, newest first
        -s  sort by filesize, biggest first
        -r  reverse order while sorting

def c_ls(api, args, verbose=False):
    """
List bitstreams of an object::

    usage: cdstar ls [options] <URL>

    options:
        -t  sort by modification time, newest first
        -s  sort by filesize, biggest first
        -r  reverse order while sorting
"""
    obj = api.get_object(args['<URL>'].split('/')[-1])
    res = []
    for bitstream in obj.bitstreams:
        res.append((
            api.url(bitstream),
            bitstream._properties['content-type'],
            bitstream._properties['filesize'],
            datetime.fromtimestamp(bitstream._properties['last-modified'] / 1000.0)
        ))
    if args['-t']:
        res = sorted(res, key=lambda t: t[3], reverse=True)
    elif args['-s']:
        res = sorted(res, key=lambda t: t[2], reverse=True)
    if args['-r']:
        res = reversed(res)

    for r in res:
        yield '{0}\t{1}\t{2:>8}\t{3}'.format(*r) if verbose else r[0]