summaryrefslogtreecommitdiff
path: root/lib/mixlib/cli/formatter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mixlib/cli/formatter.rb')
-rw-r--r--lib/mixlib/cli/formatter.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/mixlib/cli/formatter.rb b/lib/mixlib/cli/formatter.rb
index b89090d..fef8503 100644
--- a/lib/mixlib/cli/formatter.rb
+++ b/lib/mixlib/cli/formatter.rb
@@ -10,6 +10,9 @@ module Mixlib
# @return [String] the formatted flag name as described above
def self.combined_option_display_name(short, long)
usage = ""
+ # short/long may have an argument (--long ARG)
+ # splitting on " " and taking first ensures that we get just
+ # the flag name without the argument if one is present.
usage << short.split(" ").first if short
usage << "/" if long && short
usage << long.split(" ").first if long