2 Commits

Author SHA1 Message Date
Dave Gallant
d41de41c49 Display error in feed description if external viewer is not found (#19) 2020-07-20 22:56:09 -04:00
dependabot-preview[bot]
9eb31f4e08 Bump github.com/spf13/afero from 1.3.1 to 1.3.2 (#18)
Bumps [github.com/spf13/afero](https://github.com/spf13/afero) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/spf13/afero/releases)
- [Commits](https://github.com/spf13/afero/compare/v1.3.1...v1.3.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-14 22:00:58 -04:00
6 changed files with 13 additions and 15 deletions

View File

@@ -31,11 +31,7 @@ If a configuration is not provided, a default configuration is generated.
- `feeds` is a list of RSS/Atom feeds to be loaded in srv.
- `externalViewer` defines an application to override the default web browser (optional).
An example config can be copied:
```shell
cp ./config-example.yml ~/.config/srv/config.yml
```
An example config can be found [here](./config-example.yml).
## navigate

View File

@@ -25,7 +25,6 @@ type Configuration struct {
Feeds []string `yaml:"feeds"`
ExternalViewer string `yaml:"externalViewer,omitempty"`
ExternalViewerArgs []string `yaml:"externalViewerArgs,omitempty"`
Path string
}
// DefaultConfiguration can be used if a config is missing
@@ -35,7 +34,6 @@ var DefaultConfiguration = Configuration{
"https://www.phoronix.com/rss.php",
"https://www.zdnet.com/topic/security/rss.xml",
},
Path: ConfigPath,
}
// GetUGetUGetUserConfigPath returns the full configuration path for the current user
@@ -58,7 +56,6 @@ func DetermineExternalViewer() (string, error) {
case "darwin":
return "open", nil
}
return "", errors.New("Unable to determine a default external viewer")
}

View File

@@ -51,12 +51,17 @@ func getCurrentFeedItem(v *gocui.View) *gofeed.Item {
// displayDescription displays feed description if it exists
func displayDescription(g *gocui.Gui, v *gocui.View) {
item := getCurrentFeedItem(v)
description := utils.StripHTMLTags(item.Description)
setDescription(g, v, description)
}
// setDescription displays text in the bottom panel
func setDescription(g *gocui.Gui, v *gocui.View, description string) {
ov, _ := g.View("Description")
ov.Clear()
item := getCurrentFeedItem(v)
description := utils.StripHTMLTags(item.Description)
fmt.Fprintln(ov, description)
}
@@ -69,7 +74,7 @@ func openItem(g *gocui.Gui, v *gocui.View) error {
append(Controller.Config.ExternalViewerArgs, item.Link)...).Start()
if err != nil {
log.Fatal(err)
setDescription(g, v, err.Error())
}
return nil

2
go.mod
View File

@@ -13,7 +13,7 @@ require (
github.com/mmcdole/gofeed v1.0.0
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/nsf/termbox-go v0.0.0-20200204031403-4d2b513ad8be // indirect
github.com/spf13/afero v1.3.1
github.com/spf13/afero v1.3.2
github.com/stretchr/testify v1.6.1
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect
golang.org/x/text v0.3.2 // indirect

4
go.sum
View File

@@ -46,8 +46,8 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/spf13/afero v1.3.1 h1:GPTpEAuNr98px18yNQ66JllNil98wfRZ/5Ukny8FeQA=
github.com/spf13/afero v1.3.1/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4=
github.com/spf13/afero v1.3.2 h1:GDarE4TJQI52kYSbSAmLiId1Elfj+xgSDqrUZxFhxlU=
github.com/spf13/afero v1.3.2/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=

2
install.sh Normal file → Executable file
View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
VERSION='0.1.1'; \
VERSION='0.1.2'
sudo curl --progress-bar \
-L "https://github.com/davegallant/srv/releases/download/v${VERSION}/srv_${VERSION}_$(uname -s)_x86_64.tar.gz" | \
sudo tar -C /usr/bin --overwrite -xvzf - srv