~chrisppy/beagles

969e2d6328fa3eee59bb121b25e932990870e270 — Chris Palmer a month ago 51286e9
Fix typo in examples and cleanup config
2 files changed, 15 insertions(+), 27 deletions(-)

M config/config.go
M doc/beagles-config.5.scd
M config/config.go => config/config.go +13 -25
@@ 164,34 164,22 @@ type KeyCMD struct {
	Key   tcell.Key
}

// Command config
type Command struct {
	Bin  string
	Args []string
}

// Podcast config
type Podcast struct {
	AutoDownload   bool
	ExternalPlayer *ExternalPlayer
}

// ExternalPlayer config
type ExternalPlayer struct {
	Bin  string
	Args []string
	ExternalPlayer *Command
}

// Browser config
type Browser struct {
	HTTP   *HTTPBrowser
	Gemini *GeminiBrowser
}

// GeminiBrowser config
type GeminiBrowser struct {
	Bin  string
	Args []string
}

// HTTPBrowser config
type HTTPBrowser struct {
	Bin  string
	Args []string
	HTTP   *Command
	Gemini *Command
}

func createKeyCMD(key string) KeyCMD {


@@ 375,7 363,7 @@ func processBrowser(cfg scfg.Block) (*Browser, map[error]bool) {
			if !found {
				errors[fmt.Errorf(`[URL] must be one of the args provided for %s "http"`, browser)] = false
			} else {
				b.HTTP = &HTTPBrowser{
				b.HTTP = &Command{
					Bin:  bin,
					Args: args,
				}


@@ 384,7 372,7 @@ func processBrowser(cfg scfg.Block) (*Browser, map[error]bool) {
			if !found {
				errors[fmt.Errorf(`[URL] must be one of the args provided for %s "gemini"`, browser)] = false
			} else {
				b.Gemini = &GeminiBrowser{
				b.Gemini = &Command{
					Bin:  bin,
					Args: args,
				}


@@ 430,7 418,7 @@ func processPodcast(cfg scfg.Block) (*Podcast, map[error]bool) {
	} else if len(v) < 2 {
		errors[fmt.Errorf("at least 2 elements are required for %s", externalPlayer)] = false
	} else {
		e := &ExternalPlayer{
		e := &Command{
			Args: make([]string, len(v)-1),
		}



@@ 795,7 783,7 @@ func defaultConfig() *Config {
		},
		Podcast: Podcast{
			AutoDownload: false,
			ExternalPlayer: &ExternalPlayer{
			ExternalPlayer: &Command{
				Bin:  "ffplay",
				Args: []string{"[FILE]"},
			},

M doc/beagles-config.5.scd => doc/beagles-config.5.scd +2 -2
@@ 174,7 174,7 @@ Browser is defined within _browser_ "http"|"gemini" _{_ _}_ blocks.
	The command to open the browser, must have [URL]++
as one of the arguments as that will substitute the++
url to open.++
Example: navigate "xdg-open [URL]"
Example: navigate "xdg-open" "[URL]"

## PODCAST



@@ 188,7 188,7 @@ be downloaded.
	The command to open the podcast with the media player,++
must have [FILE] as one of the arguments as that will++
substitute the podcast file to play.++
Example: external-player "ffplay [FILE]"
Example: external-player "ffplay" "[FILE]"

# SEE ALSO
	*beagles*(1)