Documentation ¶
Overview ¶
Copyright © 2020 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CompletionCmd = &cobra.Command{ Use: "completion [bash|zsh|fish|powershell]", Short: "Generate completion script", Long: `To load completions: Bash: $ source <(yourprogram completion bash) # To load completions for each session, execute once: Linux: $ yourprogram completion bash > /etc/bash_completion.d/yourprogram MacOS: $ yourprogram completion bash > /usr/local/etc/bash_completion.d/yourprogram Zsh: # If shell completion is not already enabled in your environment you will need # to enable it. You can execute the following once: $ echo "autoload -U compinit; compinit" >> ~/.zshrc # To load completions for each session, execute once: $ yourprogram completion zsh > "${fpath[1]}/_yourprogram" # You will need to start a new shell for this setup to take effect. Fish: $ yourprogram completion fish | source # To load completions for each session, execute once: $ yourprogram completion fish > ~/.config/fish/completions/yourprogram.fish `, DisableFlagsInUseLine: true, ValidArgs: []string{"bash", "zsh", "powershell"}, Args: cobra.ExactValidArgs(1), Run: func(cmd *cobra.Command, args []string) { switch args[0] { case "bash": cmd.Root().GenBashCompletion(os.Stdout) case "zsh": cmd.Root().GenZshCompletion(os.Stdout) case "powershell": cmd.Root().GenPowerShellCompletion(os.Stdout) } }, }
completionCmd represents the completion command
View Source
var Test = &cobra.Command{ Use: "test", Short: "test stuff.", Long: pretty.Sprint("test"), Run: func(cmd *cobra.Command, args []string) { pretty.Println(shell.ResolveFlags(cmd.Flags())) }, }
View Source
var Version = &cobra.Command{ Use: "version", Short: "Prints out environmental variables", Long: ``, Run: func(cmd *cobra.Command, args []string) { api.EnvironmentalVariables() apiKey := viper.GetString("MERAKI_DASHBOARD_API_KEY") baseUrl := viper.GetString("MERAKI_DASHBOARD_API_URL") version := viper.GetString("MERAKI_DASHBOARD_API_VERSION") obfuscated := string(apiKey[len(apiKey)-6:]) pretty.Println("API KEY is : *****************" + obfuscated) pretty.Println("API Version is :", version) pretty.Println("API BaseUrl is :", baseUrl) }, }
version
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.