Add dummy endpoint for subcommands

This commit is contained in:
sophia 2021-04-08 16:26:10 -05:00 committed by Paul Hinze
parent 893e37711e
commit 1f432350ea
No known key found for this signature in database
GPG key ID: B69DEDF2D55501C0
3 changed files with 19 additions and 0 deletions

View file

@ -338,6 +338,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "hashicorp.vagrant.sdk.Command.ExecuteResp" do
optional :exit_code, :int64, 1
end
add_message "hashicorp.vagrant.sdk.Command.SubcommandResp" do
repeated :commands, :string, 1
end
add_message "hashicorp.vagrant.sdk.Command.Arguments" do
repeated :flags, :message, 1, "hashicorp.vagrant.sdk.Command.Arguments.Flag"
repeated :args, :string, 2
@ -611,6 +614,7 @@ module Hashicorp
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
Command::ExecuteResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command.ExecuteResp").msgclass
Command::SubcommandResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command.SubcommandResp").msgclass
Command::Arguments = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command.Arguments").msgclass
Command::Arguments::Flag = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command.Arguments.Flag").msgclass
Command::Arguments::Flag::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command.Arguments.Flag.Type").enummodule

View file

@ -149,6 +149,8 @@ module Hashicorp
rpc :Flags, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Command::FlagsResp
rpc :ExecuteSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec
rpc :Execute, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Command::ExecuteResp
rpc :SubcommandSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec
rpc :Subcommands, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Command::SubcommandResp
end
Stub = Service.rpc_stub_class

View file

@ -67,6 +67,19 @@ module VagrantPlugins
end
end
def subcommand_spec(*args)
return SDK::FuncSpec.new
end
def subcommands(req, ctx)
ServiceInfo.with_info(ctx) do |info|
end
SDK::Command::SubcommandResp.new(
commands: ["test", "thing"],
)
end
def augment_cmd_class(cmd_cls)
# Create a new anonymous class based on the command class
# so we can modify the setup behavior