@@ -45,17 +45,31 @@ func (r *runners) initVMEndpointCmd(parent *cobra.Command, endpointType string)
4545 protocol := strings .ToUpper (endpointType )
4646 cmdUse := fmt .Sprintf ("%s-endpoint VM_ID_OR_NAME" , endpointType )
4747 cmdShort := fmt .Sprintf ("Get the %s endpoint of a VM" , protocol )
48-
4948 outputFormat := fmt .Sprintf ("%s://username@hostname:port" , endpointType )
5049
50+ var scriptExample string
51+ switch endpointType {
52+ case EndpointTypeSSH :
53+ scriptExample = `# Use the endpoint to SSH to a VM by name
54+ ssh $(replicated vm ssh-endpoint my-test-vm)`
55+ case EndpointTypeSCP :
56+ scriptExample = `# Use the endpoint to SCP a file to a VM by name
57+ scp /tmp/my-file $(replicated vm scp-endpoint my-test-vm)//dst/path/my-file
58+
59+ # Use the endpoint to SCP a file from a VM by name
60+ scp $(replicated vm scp-endpoint my-test-vm)//src/path/my-file /tmp/my-file`
61+ default :
62+ scriptExample = ""
63+ }
64+
5165 cmdLong := fmt .Sprintf (`Get the %s endpoint and port of a VM.
5266
5367The output will be in the format: %s
5468
5569You can identify the VM either by its unique ID or by its name.
5670
5771Note: %s endpoints can only be retrieved from VMs in the "running" state.
58-
72+
5973VMs are currently a beta feature.` , protocol , outputFormat , protocol )
6074
6175 cmdExample := fmt .Sprintf (`# Get %s endpoint for a specific VM by ID
@@ -65,7 +79,9 @@ replicated vm %s-endpoint aaaaa11
6579replicated vm %s-endpoint my-test-vm
6680
6781# Get %s endpoint with a custom username
68- replicated vm %s-endpoint my-test-vm --username custom-user` , protocol , endpointType , protocol , endpointType , protocol , endpointType )
82+ replicated vm %s-endpoint my-test-vm --username custom-user
83+
84+ %s` , protocol , endpointType , protocol , endpointType , protocol , endpointType , scriptExample )
6985
7086 cmd := & cobra.Command {
7187 Use : cmdUse ,
0 commit comments