Resilience: - RetryTransport with circuit breaker for 429/5xx resilience - Exponential backoff with jitter, respects Retry-After headers - Circuit breaker auto-resets after 30s of successful requests Performance: - Concurrent gmail thread fetching (fixes N+1 query pattern) - Bounded concurrency with semaphore (max 10 parallel) New calendar commands: - colors: list available event/calendar colors - conflicts: check availability across calendars - search: find events by text query - time: show current time in multiple timezones New gmail commands: - autoforward: get/enable/disable auto-forwarding - delegates: list/add/remove mail delegation - filters: list/create/delete inbox filters - forwarding: manage forwarding addresses - sendas: manage send-as aliases - vacation: get/enable/disable vacation responder - batch: bulk operations (mark-read, archive, label, delete) - watch: Pub/Sub push with webhook forwarding New services: - Sheets: read/write/append spreadsheet data - Tasks: manage tasklists and tasks Developer experience: - Shell completion (bash, zsh, fish, powershell) - version command with build info - --debug flag for verbose logging - lefthook for pre-commit hooks Documentation: - Expanded README with examples - Gmail watch/Pub/Sub guide (docs/watch.md) - Architecture spec (docs/spec.md) - Release process (docs/RELEASING.md)
63 lines
1.8 KiB
Go
63 lines
1.8 KiB
Go
package cmd
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func newCompletionCmd() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "completion [bash|zsh|fish|powershell]",
|
|
Short: "Generate shell completion scripts",
|
|
Long: `Generate shell completion scripts for gog.
|
|
|
|
To load completions:
|
|
|
|
Bash:
|
|
$ source <(gog completion bash)
|
|
# To load completions for each session, execute once:
|
|
# Linux:
|
|
$ gog completion bash > /etc/bash_completion.d/gog
|
|
# macOS:
|
|
$ gog completion bash > $(brew --prefix)/etc/bash_completion.d/gog
|
|
|
|
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:
|
|
$ gog completion zsh > "${fpath[1]}/_gog"
|
|
# You will need to start a new shell for this setup to take effect.
|
|
|
|
Fish:
|
|
$ gog completion fish | source
|
|
# To load completions for each session, execute once:
|
|
$ gog completion fish > ~/.config/fish/completions/gog.fish
|
|
|
|
PowerShell:
|
|
PS> gog completion powershell | Out-String | Invoke-Expression
|
|
# To load completions for every new session, run:
|
|
PS> gog completion powershell > gog.ps1
|
|
# and source this file from your PowerShell profile.
|
|
`,
|
|
DisableFlagsInUseLine: true,
|
|
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
|
|
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
switch args[0] {
|
|
case "bash":
|
|
return cmd.Root().GenBashCompletion(os.Stdout)
|
|
case "zsh":
|
|
return cmd.Root().GenZshCompletion(os.Stdout)
|
|
case "fish":
|
|
return cmd.Root().GenFishCompletion(os.Stdout, true)
|
|
case "powershell":
|
|
return cmd.Root().GenPowerShellCompletionWithDesc(os.Stdout)
|
|
}
|
|
return nil
|
|
},
|
|
}
|
|
return cmd
|
|
}
|