Michał Górny avatar Michał Górny committed 7503f1e

Support --quiet to silence the warnings.

Comments (0)

Files changed (1)


 from flaggie.cleanup import DropIneffective, SortEntries, SortFlags
 from flaggie.packagefile import PackageFiles
-def parse_actions(args, dbapi, settings, strict = False):
+def parse_actions(args, dbapi, settings, quiet = False, strict = False):
 	out = []
 	cache = Caches(dbapi)
 	actset = ActionSet(cache = cache)
 		except (ParserError, ParserWarning) as e:
-			print('At argv[%d]=\'%s\': %s' % (i + 1, a, e))
+			if not quiet or strict:
+				print('At argv[%d]=\'%s\': %s' % (i + 1, a, e))
 			if strict:
-				print('Strict mode, aborting.')
+				if not quiet:
+					print('Strict mode, aborting.')
 				return None
 	if actset and (actset.pkgs or not had_pkgs):
 def main(argv):
 	cleanup_actions = set()
+	quiet = False
 	strict = False
 	for a in list(argv[1:]):
 %s [<options>] [<global-actions>] [<packages> <actions>] [...]
+	--quiet			Silence argument errors and warnings
 	--strict		Abort if at least a single flag is invalid
 	--drop-ineffective	Drop ineffective flags (those which are
 A package specification can be any atom acceptable for Portage (in the same
 format as taken by emerge).''' % os.path.basename(argv[0]))
 				return 0
+			elif a == '--quiet':
+				quiet = True
 			elif a == '--strict':
 				strict = True
 			elif a == '--drop-ineffective':
 			target_root = os.environ.get('ROOT'))
 	porttree = trees[max(trees)]['porttree']
-	act = parse_actions(argv[1:], porttree.dbapi, porttree.settings, strict = strict)
+	act = parse_actions(argv[1:], porttree.dbapi, porttree.settings, \
+			quiet = quiet, strict = strict)
 	if act is None:
 		return 1
 	if not act and not cleanup_actions:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.