output_separator = u"\n"

    select_files = True
    select_dirs = True
    if args.type == 'f':
        select_dirs = False
    elif args.type == 'd':
        select_files = False

    encoding = 'utf-8' #TODO make encoding option

    #act
    stdout_isatty = sys.stdout.isatty()
    for path in files.find(
                u".",
                min_depth=min_depth,
                max_depth=max_depth,
            ):

        isfile = os.path.isfile(path)
        if ( isfile and select_files ) or ( not isfile and select_dirs ):

            #initialize
            head, bname = os.path.split(path)
            accept=True
            color_spans = [] #start end pairs span pairs to color in between

            #find those that match
            for reg in res:
                if stdout_isatty: #must find all matches to color them later
                    matches = list(reg.finditer(bname))
        action="store_true", 
        default=False, 
        help="Remove original files after successful split. Default False.")

    parser.add_argument('-t', '--output_filename_format',
        help="Ouptut filename format. Same as shnsplit -t. Default '%%n - %%p - %%t'",
        default="%n - %p - %t")

    args = parser.parse_args(sys.argv[1:])
    output_format = args.output_format
    remove_original_files = args.remove_original_files
    output_filename_format = args.output_filename_format

    errors = []

    for cue_path in files.find(u'.'):

        if cue_path.endswith('.cue'):

            parent_dir, cue_bname_noext, dotext = files.split3(cue_path)

            def accept(path):
                parent_dir, bname_noext, dotext = files.split3(path)
                return bname_noext == cue_bname_noext and dotext[1:] in AUDIO_EXTS

            audio_file_candidates = filter(accept, os.listdir(parent_dir))

            ncandidates = len(audio_file_candidates)

            if ncandidates == 0: #only one candidate, so take him!
                error = "No audio candidates for:\n%s" % cue_path
#------------------------------------------------------------
#
# Ciro D. Santilli 
#
# Find files which follow bad naming practices, and print them.
#
#------------------------------------------------------------

import os.path

from cirosantilli import files
from cirosantilli.files import FORBIDDEN_BASENAME_CHARS, MAX_BNAME_LENGTH

if __name__ == '__main__':

    for path in files.find(u'.'):
        head, bname = os.path.split(path)
        bname_noext, ext = os.path.splitext(bname)
        for c in FORBIDDEN_BASENAME_CHARS:
            if c in bname:
                print path
                print "forbidden char: '%s' decimal: %d" % (c,ord(c))
                print
        if len(bname) > MAX_BNAME_LENGTH:
            print path
            print "basename longer than %d" % MAX_BNAME_LENGTH
            print
        if bname[0] == '-':
            print path
            print "basename starts with a hyphen '-'"
            print