Fetch command banner and remove switch characters

This commit is contained in:
Chris Roberts 2022-01-19 10:09:35 -08:00 committed by Paul Hinze
parent 5e6fe71a37
commit 1a32e8c2f9
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0

View File

@ -93,15 +93,15 @@ module VagrantPlugins
hlp_msg = "" hlp_msg = ""
flags = [] flags = []
else else
hlp_msg = options.help hlp_msg = options.banner
# Now we can build our list of flags # Now we can build our list of flags
flags = options.top.list.find_all { |o| flags = options.top.list.find_all { |o|
o.is_a?(OptionParser::Switch) o.is_a?(OptionParser::Switch)
}.map { |o| }.map { |o|
SDK::Command::Flag.new( SDK::Command::Flag.new(
description: o.desc.join(" "), description: o.desc.join(" "),
long_name: o.switch_name, long_name: o.switch_name.to_s.gsub(/^-/, ''),
short_name: o.short.first, short_name: o.short.first.to_s.gsub(/^-/, ''),
type: o.is_a?(OptionParser::Switch::NoArgument) ? type: o.is_a?(OptionParser::Switch::NoArgument) ?
SDK::Command::Flag::Type::BOOL : SDK::Command::Flag::Type::BOOL :
SDK::Command::Flag::Type::STRING SDK::Command::Flag::Type::STRING