From a6ff1ebf2e16eae2dbba6d86d11b33d63b9fe5f1 Mon Sep 17 00:00:00 2001 From: kojix2 <2xijok@gmail.com> Date: Sat, 14 Nov 2020 23:41:35 +0900 Subject: [PATCH] show the help option on usage --- lib/uplot/command/parser.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/uplot/command/parser.rb b/lib/uplot/command/parser.rb index f7fc2e8..8bbba89 100644 --- a/lib/uplot/command/parser.rb +++ b/lib/uplot/command/parser.rb @@ -81,6 +81,12 @@ module Uplot opt.on('--fmt VAL', String, 'xyxy : header is like x1, y1, x2, y2, x3, y3...', 'xyy : header is like x, y1, y2, y2, y3...') do |v| @fmt = v end + # Optparse adds the help option, but it doesn't show up in usage. + # This is why you need the code below. + opt.on('--help', 'print sub-command help menu') do + puts opt.help + exit + end opt.on('--debug', TrueClass, 'print preprocessed data') do |v| @debug = v end