tools: generate version number and give it to tools
[nit.git] / src / abstracttool.nit
index 756117a..b03c827 100644 (file)
@@ -21,6 +21,7 @@ package abstracttool
 
 import mmloader
 import syntax
+import nit_version
 
 class AbstractCompiler
 special ToolContext
@@ -40,6 +41,11 @@ special ToolContext
        do
                process_options
 
+               if opt_version.value then
+                       print "{tool_name} version {nit_version}"
+                       exit(0)
+               end
+
                if opt_help.value then
                        print "usage: {tool_name} [options] file..."
                        option_context.usage