lib/taskjuggler/Tj3AppBase.rb in taskjuggler-3.6.0 vs lib/taskjuggler/Tj3AppBase.rb in taskjuggler-3.7.1
- old
+ new
@@ -49,20 +49,19 @@
def processArguments(argv)
@opts = OptionParser.new
@opts.summary_width = @optsSummaryWidth
@opts.summary_indent = ' ' * @optsSummaryIndent
- @opts.banner = "#{AppConfig.softwareName} v#{AppConfig.version} - " +
- "#{AppConfig.packageInfo}\n\n" +
- "Copyright (c) #{AppConfig.copyright.join(', ')}\n" +
+ @opts.banner = "Copyright (c) #{AppConfig.copyright.join(', ')}\n" +
" by #{AppConfig.authors.join(', ')}\n\n" +
"#{AppConfig.license}\n" +
"For more info about #{AppConfig.softwareName} see " +
"#{AppConfig.contact}\n\n" +
"Usage: #{AppConfig.appName} [options] " +
"#{@mandatoryArgs}\n\n"
- @opts.separator ""
+
+ @opts.separator "\nOptions:"
@opts.on('-c', '--config <FILE>', String,
format('Use the specified YAML configuration file')) do |arg|
@configFile = arg
end
@opts.on('--silent',
@@ -73,11 +72,11 @@
end
@opts.on('--no-color',
format(<<'EOT'
Don't use ANSI contol sequences to color the terminal output. Colors should
only be used when spooling to an ANSI terminal. In case the detection fails,
-you can this option to force colors to be off.
+you can use this option to force colors to be off.
EOT
)) do
Term::ANSIColor::coloring = false
end
@opts.on('--debug', format('Enable Ruby debug mode')) do
@@ -89,12 +88,27 @@
@opts.on_tail('-h', '--help', format('Show this message')) do
puts @opts.to_s
quit
end
@opts.on_tail('--version', format('Show version info')) do
- puts "#{AppConfig.softwareName} v#{AppConfig.version} - " +
- "#{AppConfig.packageInfo}"
+# Display the software name and version in GNU format
+# as expected by help2man
+# https://www.gnu.org/prep/standards/standards.html#g_t_002d_002dversion
+ puts "#{AppConfig.appName} (#{AppConfig.softwareName}) #{AppConfig.version}\n"
+# To also display the copyright and license statements in GNU format
+# uncomment the following and remove the equivalent statements from
+# --help
+# +
+#<<'EOT'
+#Copyright (C) 2016 Chris Schlaeger <cs@taskjuggler.org>
+#License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>
+#This is free software; you can redistribute it and/or modify it under
+#the terms of version 2 of the GNU General Public License as published by the
+#Free Software Foundation.
+#
+#For more info about TaskJuggler see http://www.taskjuggler.org
+#EOT
quit
end
begin
files = @opts.parse(argv)
@@ -126,11 +140,11 @@
retVal = 0
begin
args = processArguments(argv)
# If DEBUG mode has been enabled, we restore the INT trap handler again
- # to get Ruby backtrackes.
+ # to get Ruby backtraces.
Kernel.trap('INT', intHandler) if $DEBUG
unless @silent
puts "#{AppConfig.softwareName} v#{AppConfig.version} - " +
"#{AppConfig.packageInfo}\n\n" +
@@ -144,10 +158,10 @@
begin
MessageHandlerInstance.instance.trapSetup = true
retVal = appMain(args)
MessageHandlerInstance.instance.trapSetup = false
rescue TjRuntimeError
- # We have hit a sitatuation that we can't recover from. A message
+ # We have hit a situation that we can't recover from. A message
# was severed via the MessageHandler to inform the user and we now
# abort the program.
return 1
end