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 or name to be specified via -p, --project, the LH_PROJECT environment variable or the config file. On Unix systems, the default config file is $HOME/.lh.yaml. On Windows systems, the default config file is %HOMEDRIVE%\%HOMEPATH%\.lh.yaml, falling back to %USERPROFILE%\.lh.yaml if necessary. On all systems, the default can be overridden with --config. `, PersistentPreRun: func(cmd *cobra.Command, args []string) { account, token, email, password, interval, burstSize := viper.GetString("account"), viper.GetString("token"), viper.GetString("email"), viper.GetString("password"), viper.GetDuration("rate-limit-interval"), viper.GetInt("rate-limit-burst-size") if len(account) == 0 { FatalUsage(cmd, "Please specify Lighthouse account name via -a, --account, LH_ACCOUNT or config file") } lt := &lighthouse.Transport{ TokenAsBasicAuth: true, } client := &http.Client{ Transport: lt, } if len(token) > 0 { lt.Token = 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 { FatalUsage(cmd, err) } pw = strings.TrimSpace(string(buf)) } lt.Email = email lt.Password = pw } else { FatalUsage(cmd, "Please specify token or email & password") } if interval != time.Duration(0) { lt.RateLimitInterval = interval lt.RateLimitBurstSize = burstSize } service = lighthouse.NewService(account, client) service.RateLimitRetryRequests = true }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func FatalUsage ¶ added in v0.2.0
func MilestoneID ¶ added in v0.2.0
Types ¶
This section is empty.
Source Files ¶
- create.go
- create_bin.go
- create_changeset.go
- create_message.go
- create_milestone.go
- create_project.go
- create_ticket.go
- delete.go
- delete_bin.go
- delete_changeset.go
- delete_message.go
- delete_milestone.go
- delete_project.go
- delete_ticket.go
- export.go
- get.go
- get_bin.go
- get_changeset.go
- get_message.go
- get_milestone.go
- get_plan.go
- get_profile.go
- get_project.go
- get_ticket.go
- get_token.go
- get_user.go
- list.go
- list_bins.go
- list_changesets.go
- list_messages.go
- list_milestones.go
- list_projects.go
- list_tickets.go
- root.go
- update.go
- update_bin.go
- update_message.go
- update_milestone.go
- update_project.go
- update_ticket.go
- update_tickets.go
- update_user.go
Click to show internal directories.
Click to hide internal directories.