On Fri, Oct 09, 2020 at 05:24:59PM +0800, Wu Fengguang wrote:
On Fri, Oct 09, 2020 at 03:44:11PM +0800, Lu Weitao wrote:
background: follow doc/code_spec.md, command line tool should support help output
Signed-off-by: Lu Weitao luweitaobe@163.com
sbin/result2stats | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/sbin/result2stats b/sbin/result2stats index 85d68a7..fb69b15 100755 --- a/sbin/result2stats +++ b/sbin/result2stats @@ -3,8 +3,15 @@
# frozen_string_literal: true
+# --------------------------------------------------------------------------- +# Usage: result2stats result_root +# eg: +# result2stats /srv/result/iperf/crystal.69948 +# ---------------------------------------------------------------------------
That's duplicate info if you already have -h implemented below. The eg: line can be moved to -h output, too.
ok, got it!
Thanks, Weitao
Thanks, Fengguang
CCI_SRC = File.dirname(__dir__)
+require 'optparse' require "#{CCI_SRC}/lib/matrix2"
File.umask 0o002 @@ -16,6 +23,25 @@ def extract_stats(result_root) system job_script, 'extract_stats' end
-result_root = ARGV[0] || ENV['RESULT_ROOT'] +opt_parser = OptionParser.new do |opts|
- opts.banner = 'Usage: result2stats result_root'
- opts.separator ''
- opts.separator 'options:'
- opts.on_tail('-h', '--help', 'show this message') do
- puts opts
- exit
- end
+end
+argv = if ARGV == []
['-h']
else
ARGV
end
+opt_parser.parse!(argv)
+result_root = argv[0] || ENV['RESULT_ROOT'] extract_stats result_root create_stats result_root -- 2.23.0