github.com/fnproject/cli@v0.0.0-20240508150455-e5d88bd86117/commands/config.go (about) 1 /* 2 * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package commands 18 19 import ( 20 "strings" 21 22 "github.com/fnproject/cli/common" 23 "github.com/urfave/cli" 24 ) 25 26 // ConfigCommand returns config cli.command dependant on command parameter 27 func ConfigCommand(command string) cli.Command { 28 var cmds []cli.Command 29 switch command { 30 case "list": 31 cmds = GetCommands(ConfigListCmds) 32 case "get": 33 cmds = GetCommands(ConfigGetCmds) 34 case "configure": 35 cmds = GetCommands(ConfigCmds) 36 case "unset", "delete": 37 cmds = GetCommands(ConfigUnsetCmds) 38 } 39 40 usage := strings.Title(command) + " configurations for apps and functions" 41 42 return cli.Command{ 43 Name: "config", 44 ShortName: "config", 45 Usage: usage, 46 Aliases: []string{"cf"}, 47 ArgsUsage: "<subcommand>", 48 Description: "This command unsets the configuration of created objects ('app' or 'function').", 49 Subcommands: cmds, 50 BashComplete: common.DefaultBashComplete, 51 } 52 }