Add get commands implementation to client and server
This commit is contained in:
parent
29a5c1b855
commit
067e6aeed1
@ -121,3 +121,16 @@ func (r *RubyVagrantClient) ParseVagrantfileProvider(provider string, subvm *vag
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@ -69,6 +69,16 @@ module VagrantPlugins
|
||||
parse_item_to_proto(config.vm.get_provider_overrides(provider))
|
||||
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)
|
||||
loader = Vagrant::Config::Loader.new(
|
||||
Vagrant::Config::VERSIONS,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user