Skip to content

Commit

Permalink
Merge pull request #16 from wcarhart/feature/refresh
Browse files Browse the repository at this point in the history
Added refresh command
  • Loading branch information
wcarhart authored May 6, 2020
2 parents 70413f6 + 597455e commit a993658
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Available commands:
more - show the next 10 posts (up to 500)
less - show the previous 10 posts
back - show the previous list of posts again
refresh - refresh the master post list, which will reset the ordering of posts
clear - clear the screen
exit - quit lurker
```
10 changes: 9 additions & 1 deletion lurker
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ function __verifyjq {

function __getmasterlist {
# get master list of posts (500 total)
__startspin "Initializing"
# $1 is the loading message to use
__startspin "${1:-Initializing}"
mkdir -p "${HOME}/.lurker"
# shellcheck disable=SC2178
masterpostlist="$(curl -s 'https://hacker-news.firebaseio.com/v0/topstories.json')"
Expand Down Expand Up @@ -559,6 +560,12 @@ function __lurk {
clear)
clear
;;
refresh)
__getmasterlist "Refreshing"
startindex=0
endindex=$(( startindex + 9 ))
__getposts "$startindex" "$endindex" "Fetching posts"
;;
h|help|list)
echo "Available commands:"
echo " help - show this help menu"
Expand All @@ -570,6 +577,7 @@ function __lurk {
echo " more - show the next 10 posts (up to 500)"
echo " less - show the previous 10 posts"
echo " back - show the previous list of posts again"
echo " refresh - refresh the master post list, which will reset the ordering of posts"
echo " clear - clear the screen"
echo " exit - quit lurker"
;;
Expand Down

0 comments on commit a993658

Please sign in to comment.