From 522a111aa9fa7c5bc5a1abcc13772607abb24ca2 Mon Sep 17 00:00:00 2001 From: kojix2 <2xijok@gmail.com> Date: Wed, 16 Sep 2020 23:50:24 +0900 Subject: [PATCH] Improved help message of sub parsers --- lib/uplot/command.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/uplot/command.rb b/lib/uplot/command.rb index 3f6f5a0..cba8933 100644 --- a/lib/uplot/command.rb +++ b/lib/uplot/command.rb @@ -81,7 +81,15 @@ module Uplot end def create_sub_parsers - parsers = Hash.new { |h, k| h[k] = create_default_parser } + parsers = Hash.new do |h, k| + h[k] = create_default_parser do |parser| + parser.banner = <<~MSG + Usage: uplot #{k} [options] + + Options: + MSG + end + end parsers[:barplot] = \ parsers[:bar] @@ -187,7 +195,8 @@ module Uplot Usage: uplot [options] - Command: #{sub_parsers.keys.join(' ')} + Command: + #{sub_parsers.keys.join("\n ")} Options: MSG