blob: 9d2a5d7f8224c1d5393c9cc08bbb5823e7cde959 (
plain) (
blame)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// vespa-deploy command
// Author: arnej
package deploy
import (
"strconv"
"strings"
)
type CmdType int
const (
CmdNone CmdType = iota
CmdUpload
CmdPrepare
CmdActivate
CmdFetch
)
type Options struct {
Command CmdType
Verbose bool
DryRun bool
Force bool
Hosted bool
Application string
Environment string
From string
Instance string
Region string
Rotations string
ServerHost string
Tenant string
VespaVersion string
Timeout int
PortNumber int
}
func (opts *Options) String() string {
var buf strings.Builder
buf.WriteString("command-line options [")
if opts.DryRun {
buf.WriteString(" dry-run")
}
if opts.Force {
buf.WriteString(" force")
}
if opts.Hosted {
buf.WriteString(" hosted")
}
if opts.ServerHost != "" {
buf.WriteString(" server=")
buf.WriteString(opts.ServerHost)
}
if opts.PortNumber != 19071 {
buf.WriteString(" port=")
buf.WriteString(strconv.Itoa(opts.PortNumber))
}
if opts.From != "" {
buf.WriteString(" from=")
buf.WriteString(opts.From)
}
buf.WriteString(" ]")
return buf.String()
}
|