Commits

Michał Górny committed 2c934e9

Run cleanup_actions using a set instead of explicit enumeration.

Comments (0)

Files changed (1)

lib/flaggie/cli.py

 	return out
 
 def main(argv):
-	sort_entries = False
-	sort_flags = False
+	cleanup_actions = set()
 
 	for a in list(argv[1:]):
 		if a.startswith('--'):
 (in the same format as taken by emerge).''' % os.path.basename(argv[0]))
 				return 0
 			elif a == '--sort-entries':
-				sort_entries = True
+				cleanup_actions.add(SortEntries)
 			elif a == '--sort-flags':
-				sort_flags = True
+				cleanup_actions.add(SortFlags)
 			elif a == '--sort':
-				sort_entries = True
-				sort_flags = True
+				cleanup_actions.add(SortEntries)
+				cleanup_actions.add(SortFlags)
 			elif a == '--':
 				argv.remove(a)
 				break
 		except NotImplementedError as e:
 			print('Warning: %s' % e)
 
-	if sort_flags:
-		SortFlags(pfiles)
-	if sort_entries:
-		SortEntries(pfiles)
+	for a in cleanup_actions:
+		a(pfiles)
 
 	pfiles.write()