示例#1
0
文件: count.py 项目: jstillw/FS_Nav
def main(args):

    # Define defaults
    item_list = []

    # Loop through arguments and configure
    for arg in args:

        # Help arguments
        if arg == ('--help-info' or '-helpinfo' or '-help-info' or '--helpinfo'):
            return print_help_info()
        elif arg == ('--help' or '-help'):
            return print_help()
        elif arg == ('--usage' or '-usage'):
            return print_usage()
        elif arg == ('--version' or '-version'):
            return print_version()
        elif arg == ('--license' or '-license'):
            return print_license()

        # Assume all other arguments are items to glob
        else:
            item_list.append(arg)

    # Call function
    print(fsnav.count(item_list))
    return 0
示例#2
0
 def test_count(self):
     # Test with input values that are all unique
     test_string = expanduser('~') + sep + '*'
     expected = len(list(set(glob(test_string))))
     actual = fsnav.count([test_string])
     self.assertEqual(expected, actual)