cli + tui to publish to leaflet (wip) & manage tasks, notes & watch/read lists 馃崈
charm leaflet readability golang
29
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 51 lines 1.3 kB view raw
1//go:build !prod 2 3package tools 4 5import ( 6 "context" 7 8 "github.com/spf13/cobra" 9) 10 11// NewLexiconsCommand creates a command for fetching Leaflet lexicons 12func NewLexiconsCommand() *cobra.Command { 13 var sha string 14 var output string 15 16 cmd := &cobra.Command{ 17 Use: "lexicons", 18 Short: "Fetch Leaflet lexicons from GitHub", 19 Long: `Fetches Leaflet lexicons from the hyperlink-academy/leaflet repository. 20 21This is a convenience wrapper around gh-repo with pre-configured defaults 22for the Leaflet lexicon repository.`, 23 Example: ` # Fetch latest lexicons 24 noteleaf tools fetch lexicons 25 26 # Fetch from a specific commit 27 noteleaf tools fetch lexicons --sha abc123def 28 29 # Fetch to a custom directory 30 noteleaf tools fetch lexicons --output ./tmp/lexicons`, 31 RunE: func(cmd *cobra.Command, args []string) error { 32 config := ArchiveConfig{ 33 Repo: "hyperlink-academy/leaflet", 34 Path: "lexicons/pub/leaflet/", 35 Output: output, 36 SHA: sha, 37 FormatJSON: true, 38 } 39 40 ctx := cmd.Context() 41 if ctx == nil { 42 ctx = context.Background() 43 } 44 45 return fetchAndExtractArchive(ctx, config, cmd.OutOrStdout()) 46 }, 47 } 48 cmd.Flags().StringVar(&sha, "sha", "", "Specific commit SHA (default: latest)") 49 cmd.Flags().StringVar(&output, "output", "lexdocs/leaflet/", "Output directory for lexicons") 50 return cmd 51}