@@ -24,6 +24,9 @@ import (
24
24
25
25
const (
26
26
nBitsForKeypairDefault = 2048
27
+ bitsOptionName = "bits"
28
+ emptyRepoOptionName = "empty-repo"
29
+ profileOptionName = "profile"
27
30
)
28
31
29
32
var initCmd = & cmds.Command {
@@ -48,9 +51,9 @@ environment variable:
48
51
cmdkit .FileArg ("default-config" , false , false , "Initialize with the given configuration." ).EnableStdin (),
49
52
},
50
53
Options : []cmdkit.Option {
51
- cmdkit .IntOption ("bits" , "b" , "Number of bits to use in the generated RSA private key." ).WithDefault (nBitsForKeypairDefault ),
52
- cmdkit .BoolOption ("empty-repo" , "e" , "Don't add and pin help files to the local storage." ),
53
- cmdkit .StringOption ("profile" , "p" , "Apply profile settings to config. Multiple profiles can be separated by ','" ),
54
+ cmdkit .IntOption (bitsOptionName , "b" , "Number of bits to use in the generated RSA private key." ).WithDefault (nBitsForKeypairDefault ),
55
+ cmdkit .BoolOption (emptyRepoOptionName , "e" , "Don't add and pin help files to the local storage." ),
56
+ cmdkit .StringOption (profileOptionName , "p" , "Apply profile settings to config. Multiple profiles can be separated by ','" ),
54
57
55
58
// TODO need to decide whether to expose the override as a file or a
56
59
// directory. That is: should we allow the user to also specify the
@@ -79,8 +82,8 @@ environment variable:
79
82
return cmdkit.Error {Message : "init must be run offline only" }
80
83
}
81
84
82
- empty , _ := req .Options ["empty-repo" ].(bool )
83
- nBitsForKeypair , _ := req .Options ["bits" ].(int )
85
+ empty , _ := req .Options [emptyRepoOptionName ].(bool )
86
+ nBitsForKeypair , _ := req .Options [bitsOptionName ].(int )
84
87
85
88
var conf * config.Config
86
89
@@ -104,7 +107,7 @@ environment variable:
104
107
}
105
108
}
106
109
107
- profile , _ := req .Options ["profile" ].(string )
110
+ profile , _ := req .Options [profileOptionName ].(string )
108
111
109
112
var profiles []string
110
113
if profile != "" {
0 commit comments