Add get commands implementation to client and server

This commit is contained in:
Chris Roberts 2022-06-29 16:13:36 -07:00
parent 29a5c1b855
commit 067e6aeed1
2 changed files with 23 additions and 0 deletions

View File

@ -121,3 +121,16 @@ func (r *RubyVagrantClient) ParseVagrantfileProvider(provider string, subvm *vag
return resp.Data, nil return resp.Data, nil
} }
func (r *RubyVagrantClient) GetCommands() ([]*vagrant_plugin_sdk.Command_CommandInfo, error) {
resp, err := r.client.GetCommands(
context.Background(),
&emptypb.Empty{},
)
if err != nil {
return nil, err
}
return resp.Commands, nil
}

View File

@ -69,6 +69,16 @@ module VagrantPlugins
parse_item_to_proto(config.vm.get_provider_overrides(provider)) parse_item_to_proto(config.vm.get_provider_overrides(provider))
end end
def get_commands(req, _)
s = CommandService.new(broker: :stub)
infos = Vagrant.plugin("2").local_manager.commands.keys.map do |n|
s.send(:collect_command_info, n.to_s, [])
end
Hashicorp::Vagrant::GetCommandsResponse.new(
commands: infos,
)
end
def parse_item(item) def parse_item(item)
loader = Vagrant::Config::Loader.new( loader = Vagrant::Config::Loader.new(
Vagrant::Config::VERSIONS, Vagrant::Config::VERSIONS,