(args []string)
| 271 | } |
| 272 | |
| 273 | func (c *SecretsEnableCommand) Run(args []string) int { |
| 274 | f := c.Flags() |
| 275 | |
| 276 | if err := f.Parse(args); err != nil { |
| 277 | c.UI.Error(err.Error()) |
| 278 | return 1 |
| 279 | } |
| 280 | |
| 281 | args = f.Args() |
| 282 | switch { |
| 283 | case len(args) < 1: |
| 284 | c.UI.Error(fmt.Sprintf("Not enough arguments (expected 1, got %d)", len(args))) |
| 285 | return 1 |
| 286 | case len(args) > 1: |
| 287 | c.UI.Error(fmt.Sprintf("Too many arguments (expected 1, got %d)", len(args))) |
| 288 | return 1 |
| 289 | } |
| 290 | |
| 291 | client, err := c.Client() |
| 292 | if err != nil { |
| 293 | c.UI.Error(err.Error()) |
| 294 | return 2 |
| 295 | } |
| 296 | |
| 297 | // Get the engine type type (first arg) |
| 298 | engineType := strings.TrimSpace(args[0]) |
| 299 | if engineType == "plugin" { |
| 300 | engineType = c.flagPluginName |
| 301 | } |
| 302 | |
| 303 | // If no path is specified, we default the path to the backend type |
| 304 | // or use the plugin name if it's a plugin backend |
| 305 | mountPath := c.flagPath |
| 306 | if mountPath == "" { |
| 307 | if engineType == "plugin" { |
| 308 | mountPath = c.flagPluginName |
| 309 | } else { |
| 310 | mountPath = engineType |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | if c.flagVersion > 0 { |
| 315 | if c.flagOptions == nil { |
| 316 | c.flagOptions = make(map[string]string) |
| 317 | } |
| 318 | c.flagOptions["version"] = strconv.Itoa(c.flagVersion) |
| 319 | } |
| 320 | |
| 321 | // Append a trailing slash to indicate it's a path in output |
| 322 | mountPath = ensureTrailingSlash(mountPath) |
| 323 | |
| 324 | // Build mount input |
| 325 | mountInput := &api.MountInput{ |
| 326 | Type: engineType, |
| 327 | Description: c.flagDescription, |
| 328 | Local: c.flagLocal, |
| 329 | SealWrap: c.flagSealWrap, |
| 330 | ExternalEntropyAccess: c.flagExternalEntropyAccess, |
nothing calls this directly
no test coverage detected