From 780f26245cacbebf2e307faf20797c082673d191 Mon Sep 17 00:00:00 2001 From: Dave Gallant Date: Tue, 7 Jul 2020 23:07:09 -0400 Subject: [PATCH] Fix refresh and add install script (#17) * Fix refresh bug * Add install script --- README.md | 17 ++++++++--------- cui/keybindings.go | 2 +- cui/main.go | 3 ++- install.sh | 6 ++++++ 4 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 install.sh diff --git a/README.md b/README.md index 49a22dc..7f6292e 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,7 @@ View RSS feeds from the terminal. ### via releases ```shell -VERSION='0.1.0'; \ -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 +curl -fsSL https://raw.githubusercontent.com/davegallant/srv/master/install.sh | bash ``` ### via go @@ -44,11 +41,13 @@ cp ./config-example.yml ~/.config/srv/config.yml Key mappings are statically defined for the time being. -- `TAB` switches between Feeds and Items. -- `UP/DOWN` navigates feeds and items` -- `ENTER` either selects a feed or opens a feed item in an external application. -- `F5` refresh list of feeds -- `CTRL+C` quit +| Key | Description | +|:---------:| --------------------------------------------------------------------- | +| `TAB` | switches between Feeds and Items. | +| `UP/DOWN` | navigates feeds and items` | +| `ENTER` | either selects a feed or opens a feed item in an external application.| +| `CTRL+R` | refresh list of feeds | +| `CTRL+C` | quit | ## build diff --git a/cui/keybindings.go b/cui/keybindings.go index 537695e..705892f 100644 --- a/cui/keybindings.go +++ b/cui/keybindings.go @@ -25,7 +25,7 @@ func keybindings(g *gocui.Gui) error { if err := g.SetKeybinding("Items", gocui.KeyEnter, gocui.ModNone, openItem); err != nil { return err } - if err := g.SetKeybinding("", gocui.KeyF5, gocui.ModNone, refreshFeeds); err != nil { + if err := g.SetKeybinding("", gocui.KeyCtrlR, gocui.ModNone, refreshFeeds); err != nil { return err } return nil diff --git a/cui/main.go b/cui/main.go index 0c08acd..d3f1573 100644 --- a/cui/main.go +++ b/cui/main.go @@ -76,7 +76,8 @@ func openItem(g *gocui.Gui, v *gocui.View) error { } func refreshFeeds(g *gocui.Gui, v *gocui.View) error { - Controller.Rss.Update(Controller.Config.Feeds) + g.Close() + Start() return nil } diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..3452fd3 --- /dev/null +++ b/install.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +VERSION='0.1.1'; \ +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