"""Show a command to edit fred files"""

import os
import sys


from dotsite.paths import makepath, pwd


def get_freds(paths):
    if not paths:
        paths = ['.']
    result = set()
    for path in paths:
        path = makepath(path)
        if path.isdir():
            result |= {p for p in path.files('fred*') if p[-1] != '~'}
        elif path.isfile() and path.name.startswith('fred'):
            result.add(path)
    return [pwd().relpathto(p) for p in result]


def main(args):
    freds = get_freds(args)
    if not freds:
        return not os.EX_OK
    print 'v %s' % ' '.join(freds)
    return os.EX_OK


if __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))

"""Show a command to edit fred files"""

import os
import sys


from dotsite.paths import makepath, pwd


def get_freds(paths):
    if not paths:
        paths = ['~/tmp']
    result = set()
    for path in paths:
        path = makepath(path)
        if path.isdir():
            result |= {p for p in path.files('fred*') if p[-1] != '~'}
        elif path.isfile() and path.name.startswith('fred'):
            result.add(path)
    return [pwd().relpathto(p) for p in result]


def main(args):
    freds = get_freds(args)
    if not freds:
        return not os.EX_OK
    print 'v %s' % ' '.join(freds)
    return os.EX_OK


if __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))

Put temp files in ~/tmp by default
Put temp files in ~/tmp by default
