1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package cmd
import (
"github.com/spf13/cobra"
"github.com/vespa-engine/vespa/client/go/internal/vespa"
)
func newFetchCmd(cli *CLI) *cobra.Command {
cmd := &cobra.Command{
Use: "fetch [path]",
Short: "Download a deployed application package",
Long: `Download a deployed application package.
This command can be used to download an already deployed Vespa application
package. The package is written as a ZIP file to the given path, or current
directory if no path is given.`,
Example: `$ vespa fetch
$ vespa fetch mydir/
$ vespa fetch -t cloud mycloudapp.zip
`,
Args: cobra.MaximumNArgs(1),
DisableAutoGenTag: true,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
target, err := cli.target(targetOptions{})
if err != nil {
return err
}
path := "."
if len(args) > 0 {
path = args[0]
}
dstPath := ""
if err := cli.spinner(cli.Stderr, "Downloading application package...", func() error {
dstPath, err = vespa.Fetch(vespa.DeploymentOptions{Target: target}, path)
return err
}); err != nil {
return err
}
cli.printSuccess("Application package written to ", dstPath)
return nil
},
}
return cmd
}
|