Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "lh", Short: "lh provides CLI access to the Lighthouse API http://help.lighthouseapp.com/kb/api", Long: `lh provides CLI access to the Lighthouse API http://help.lighthouseapp.com/kb/api Please specify your Lighthouse account name via -a, --account, the LH_ACCOUNT environment variable or the config file. If your Lighthouse URL is 'https://your-account-name.lighthouseapp.com' then your account name is 'your-account-name'. Lighthouse requires a valid API token or email/password to authenticate API requests. Please specify a Lighthouse API token via -t, --token, the LH_TOKEN environment variable or the config file. If you'd prefer to authenticate with an email/password, please specify it via -e, --email, the LH_EMAIL environment variable, -p, --password, the LH_PASSWORD environment variable or the config file. If the specified password has the form '@FILE', the password is instead read from FILE. Many subcommands work on resources that are Lighthouse project-specific. These commands require the project ID to be specified via -p, --project, the LH_PROJECT environment variable or the config file. The default config file is $HOME/.lh.yaml but can be overridden with --config. `, PersistentPreRun: func(cmd *cobra.Command, args []string) { account, token, email, password := viper.GetString("account"), viper.GetString("token"), viper.GetString("email"), viper.GetString("password") if len(account) == 0 { log.Fatal("Please specify Lighthouse account name via -a, --account, LH_ACCOUNT or config file") } var client *http.Client if len(token) > 0 { client = lighthouse.NewClient(token) } else if len(email) > 0 && len(password) > 0 { pw := password if strings.HasPrefix(password, "@") && len(password) > 1 { buf, err := ioutil.ReadFile(password[1:]) if err != nil { log.Fatal(err) } pw = strings.TrimSpace(string(buf)) } client = lighthouse.NewClientBasicAuth(email, pw) } else { log.Fatal("Please specify token or email & password") } service = lighthouse.NewService(account, client) }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.