-
Notifications
You must be signed in to change notification settings - Fork 173
/
options.go
74 lines (60 loc) · 1.77 KB
/
options.go
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
71
72
73
74
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package provisioning
import "github.com/azure/azure-dev/cli/azd/pkg/output"
type ActionOptions struct {
// The desired console output format
formatter output.Formatter
// Whether or not the session supports interactive user input such as prompts
interactive bool
}
// Gets a value determining whether the console is interactive
// Console is only considered interactive when the interactive
// flag has been set and an output format has not been defined.
func (options *ActionOptions) IsInteractive() bool {
return options.interactive && options.Formatter().Kind() == output.NoneFormat
}
// Gets the specified output format
func (options *ActionOptions) Formatter() output.Formatter {
if options.formatter == nil {
options.formatter = &output.NoneFormatter{}
}
return options.formatter
}
// Infrastructure destroy options
type DestroyOptions struct {
// Whether or not to force the deletion of resources without prompting the user
force bool
// Whether or not to purge any key vaults associated with the deployment
purge bool
}
type StateOptions struct {
// A value used to lookup the state of a specific deployment
hint string
}
func NewStateOptions(hint string) *StateOptions {
return &StateOptions{
hint: hint,
}
}
func (o *StateOptions) Hint() string {
return o.hint
}
func (o *DestroyOptions) Purge() bool {
return o.purge
}
func (o *DestroyOptions) Force() bool {
return o.force
}
func NewDestroyOptions(force bool, purge bool) DestroyOptions {
return DestroyOptions{
force: force,
purge: purge,
}
}
func NewActionOptions(formatter output.Formatter, interactive bool) ActionOptions {
return ActionOptions{
formatter: formatter,
interactive: interactive,
}
}