Skip to content

Commit 40c707b

Browse files
committed
CLI: add root help examples
1 parent 8d605e1 commit 40c707b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

internal/cmd/root.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"fmt"
55
"os"
6+
"strings"
67

78
"github.com/spf13/cobra"
89
"github.com/steipete/gogcli/internal/errfmt"
@@ -22,11 +23,37 @@ func Execute(args []string) error {
2223

2324
root := &cobra.Command{
2425
Use: "gog",
26+
Short: "Google CLI for Gmail/Calendar/Drive/Contacts",
2527
SilenceUsage: true,
2628
SilenceErrors: true,
2729
CompletionOptions: cobra.CompletionOptions{
2830
DisableDefaultCmd: true,
2931
},
32+
Example: strings.TrimSpace(`
33+
# One-time setup (OAuth)
34+
gog auth credentials ~/path/to/credentials.json
35+
gog auth add you@gmail.com
36+
37+
# Avoid repeating --account
38+
export GOG_ACCOUNT=you@gmail.com
39+
40+
# Gmail
41+
gog gmail search 'newer_than:7d' --max 10
42+
gog gmail thread <threadId>
43+
gog gmail labels get INBOX --output=json
44+
45+
# Calendar
46+
gog calendar calendars
47+
gog calendar events <calendarId> --from 2025-01-01T00:00:00Z --to 2025-01-08T00:00:00Z --max 50
48+
49+
# Contacts
50+
gog contacts list --max 50
51+
gog contacts search "Ada" --max 50
52+
gog contacts other list --max 50
53+
54+
# Parseable output
55+
gog --output=json drive ls --max 5 | jq .
56+
`),
3057
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
3158
mode, err := outfmt.Parse(flags.Output)
3259
if err != nil {

0 commit comments

Comments
 (0)