Make help message work

This commit is contained in:
sophia 2021-01-26 15:10:04 -06:00 committed by Paul Hinze
parent cadcbe82f7
commit 43e4e968ef
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
2 changed files with 30 additions and 5 deletions

View File

@ -252,6 +252,18 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
end
add_message "hashicorp.vagrant.sdk.Command" do
end
add_message "hashicorp.vagrant.sdk.Command.Flag" do
optional :long_name, :string, 1
optional :short_name, :string, 2
optional :description, :string, 3
optional :default_value, :string, 4
optional :type, :enum, 5, "hashicorp.vagrant.sdk.Command.Flag.Type"
end
add_enum "hashicorp.vagrant.sdk.Command.Flag.Type" do
value :STRING, 0
value :BOOL, 2
value :INT, 3
end
add_message "hashicorp.vagrant.sdk.Command.HelpResp" do
optional :help, :string, 1
end
@ -259,7 +271,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
optional :synopsis, :string, 1
end
add_message "hashicorp.vagrant.sdk.Command.FlagsResp" do
optional :flags, :string, 1
repeated :flags, :message, 1, "hashicorp.vagrant.sdk.Command.Flag"
end
add_message "hashicorp.vagrant.sdk.Communicator" do
end
@ -381,6 +393,8 @@ module Hashicorp
Provider::InstalledResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Provider.InstalledResp").msgclass
Provider::ActionResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Provider.ActionResp").msgclass
Command = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command").msgclass
Command::Flag = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command.Flag").msgclass
Command::Flag::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command.Flag.Type").enummodule
Command::HelpResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command.HelpResp").msgclass
Command::SynopsisResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command.SynopsisResp").msgclass
Command::FlagsResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command.FlagsResp").msgclass

View File

@ -12,9 +12,12 @@ module VagrantPlugins
if !plugin
raise "Failed to locate command plugin for: #{plugin_name}"
end
# klass = plugin.call
$stashed_opts = nil
klass = Class.new(plugin.call)
klass.class_eval { def parse_options(opts); $stashed_opts = opts; nil; end };
klass.new(['-h'], {}).execute
Hashicorp::Vagrant::Sdk::Command::HelpResp.new(
help: "No help information configured"
help: $stashed_opts.help()
)
end
@ -44,9 +47,17 @@ module VagrantPlugins
if !plugin
raise "Failed to locate command plugin for: #{plugin_name}"
end
# klass = plugin.call
# klass = Class.new(plugin.call)
# klass.class_eval {
# }
Hashicorp::Vagrant::Sdk::Command::FlagsResp.new(
flags: "not implemented"
flags: [
Hashicorp::Vagrant::Sdk::Command::Flag.new(
long_name: "test", short_name: "t",
description: "does this even work?", default_value: "true",
type: Hashicorp::Vagrant::Sdk::Command::Flag::Type::BOOL
)
]
)
end
end