vala r875 - in trunk: . compiler vapigen



Author: juergbi
Date: Mon Jan 21 17:27:16 2008
New Revision: 875
URL: http://svn.gnome.org/viewvc/vala?rev=875&view=rev

Log:
2008-01-21  Juerg Billeter  <j bitron ch>

	* compiler/valacompiler.vala, vapigen/valavapigen.vala: add --quiet
	  option to valac and vapigen,
	  patch by Emmanuele Bassi, fixes bug 510998


Modified:
   trunk/ChangeLog
   trunk/compiler/valacompiler.vala
   trunk/vapigen/valavapigen.vala

Modified: trunk/compiler/valacompiler.vala
==============================================================================
--- trunk/compiler/valacompiler.vala	(original)
+++ trunk/compiler/valacompiler.vala	Mon Jan 21 17:27:16 2008
@@ -50,6 +50,7 @@
 	static bool save_temps;
 	[NoArrayLength]
 	static string[] defines;
+	static bool quiet_mode;
 
 	private CodeContext context;
 
@@ -73,16 +74,21 @@
 		{ "cc", 0, 0, OptionArg.STRING, out cc_command, "Use COMMAND as C compiler command", "COMMAND" },
 		{ "Xcc", 'X', 0, OptionArg.STRING_ARRAY, out cc_options, "Pass OPTION to the C compiler", "OPTION..." },
 		{ "save-temps", 0, 0, OptionArg.NONE, out save_temps, "Keep temporary files", null },
+		{ "quiet", 'q', 0, OptionArg.NONE, ref quiet_mode, "Do not print messages to the console", null },
 		{ "", 0, 0, OptionArg.FILENAME_ARRAY, out sources, null, "FILE..." },
 		{ null }
 	};
 	
 	private int quit () {
 		if (Report.get_errors () == 0) {
-			stdout.printf ("Compilation succeeded - %d warning(s)\n", Report.get_warnings ());
+			if (!quiet_mode) {
+				stdout.printf ("Compilation succeeded - %d warning(s)\n", Report.get_warnings ());
+			}
 			return 0;
 		} else {
-			stdout.printf ("Compilation failed: %d error(s), %d warning(s)\n", Report.get_errors (), Report.get_warnings ());
+			if (!quiet_mode) {
+				stdout.printf ("Compilation failed: %d error(s), %d warning(s)\n", Report.get_errors (), Report.get_warnings ());
+			}
 			return 1;
 		}
 	}

Modified: trunk/vapigen/valavapigen.vala
==============================================================================
--- trunk/vapigen/valavapigen.vala	(original)
+++ trunk/vapigen/valavapigen.vala	Mon Jan 21 17:27:16 2008
@@ -25,6 +25,7 @@
 class Vala.VAPIGen : Object {
 	static string directory;
 	static bool version;
+	static bool quiet_mode;
 	[NoArrayLength ()]
 	static string[] sources;
 	[NoArrayLength ()]
@@ -40,16 +41,21 @@
 		{ "library", 0, 0, OptionArg.STRING, out library, "Library name", "NAME" },
 		{ "directory", 'd', 0, OptionArg.FILENAME, out directory, "Output directory", "DIRECTORY" },
 		{ "version", 0, 0, OptionArg.NONE, ref version, "Display version number", null },
+		{ "quiet", 'q', 0, OptionArg.NONE, ref quiet_mode, "Do not print messages to the console", null },
 		{ "", 0, 0, OptionArg.FILENAME_ARRAY, out sources, null, "FILE..." },
 		{ null }
 	};
 	
 	private int quit () {
 		if (Report.get_errors () == 0) {
-			stdout.printf ("Generation succeeded - %d warning(s)\n", Report.get_warnings ());
+			if (!quiet_mode) {
+				stdout.printf ("Generation succeeded - %d warning(s)\n", Report.get_warnings ());
+			}
 			return 0;
 		} else {
-			stdout.printf ("Generation failed: %d error(s), %d warning(s)\n", Report.get_errors (), Report.get_warnings ());
+			if (!quiet_mode) {
+				stdout.printf ("Generation failed: %d error(s), %d warning(s)\n", Report.get_errors (), Report.get_warnings ());
+			}
 			return 1;
 		}
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]