Added readme and updated code to save favorites at each point that they are modified, rather than only on quit
This commit is contained in:
parent
e33633baab
commit
4b1f1ac22e
|
@ -0,0 +1,51 @@
|
|||
# Stubb
|
||||
|
||||
Stubb is a text based gopher client that only displays and supports gophertypes: 0 (text) and 1 (gopher map). The program is named for the character [Stubb from Moby Dick](https://en.wikipedia.org/wiki/List_of_Moby-Dick_characters#Crewmates), known for his imaginative patter and good humor.
|
||||
|
||||
In an effort to streamline the browsing experience for text only, gophermap rendering will not include lines with gophertypes that are not 0, 1, or i (text/display elements). Stubb supports bookmarks, file save, and session only history (cleared on quit).
|
||||
|
||||
Support for search is currently under consideration. I have not generally found Gopher search to be particularly useful. The lack of tagging and organization makes most search results from Veronica2 seem like playing the lottery. We'll see.
|
||||
|
||||
|
||||
|
||||
### Setup
|
||||
|
||||
Make sure your system has Lua 5.1 on it. I believe this application should work with 5.2 (so long as you get the appropriate dependencies), however, I believe the socket library is buggy for 5.3, so best to stay on an earlier version.
|
||||
|
||||
If you do not have luarocks package manager, get it and run: `luarocks install luasocket`
|
||||
|
||||
That should take care of dependencies. You just need to make sure that __stubb__ (found in this repo) is executable and you are good to go.
|
||||
|
||||
|
||||
|
||||
### Commands
|
||||
|
||||
Stub responds to single key commands without requiring the user to press enter. Some commands will request further information, such as a link or bookmark id: (5) or (f2) respectively.
|
||||
|
||||
[Navigation]
|
||||
(B)ack
|
||||
(F)orward
|
||||
(G)o to url
|
||||
(R)eload current address
|
||||
(V)isit link/bookmark
|
||||
|
||||
[Bookmarks]
|
||||
(A)dd bookmark
|
||||
(D)elete bookmark
|
||||
(L)ist bookmarks
|
||||
(U)pdate bookmark title
|
||||
|
||||
[System]
|
||||
(H)elp
|
||||
(Q)uit
|
||||
(S)ave file to disk
|
||||
|
||||
|
||||
|
||||
### Recommendations
|
||||
|
||||
If Stubb's slim and light style is not fitting your needs, or you just want to check out some other gopher client projects, I highly recomend the following:
|
||||
|
||||
- [Burrow](https://tildegit.org/sloum/burrow): My gui based browser with a wider featureset (primarily for *nix system)
|
||||
- [VF-1](https://github.com/solderpunk/VF-1): A great/stable gopher client written by Solderpunk, who maintains one of the best gopher communities out there, [The People's Circumlunar Zaibatsu, in Circumluanr Space](gopher://zaibatsu.circumlunar.space:70/).
|
||||
|
29
stubb
29
stubb
|
@ -177,6 +177,8 @@ function add_favorite()
|
|||
until title
|
||||
if title == '!' then return print('Cancelled') end
|
||||
table.insert(session.favorites,{display = title, link = session.history.items[session.history.loc]})
|
||||
print('Bookmark added')
|
||||
save_favorites()
|
||||
end
|
||||
|
||||
|
||||
|
@ -197,6 +199,7 @@ function update_favorite()
|
|||
end
|
||||
item.display = title
|
||||
print('Bookmark has been updated')
|
||||
save_favorites()
|
||||
else
|
||||
print('Invalid bookmark id')
|
||||
end
|
||||
|
@ -216,6 +219,7 @@ function remove_favorite()
|
|||
if item then
|
||||
table.remove(session.favorites, id)
|
||||
print('Bookmark has been removed')
|
||||
save_favorites()
|
||||
else
|
||||
print('Invalid bookmark id')
|
||||
end
|
||||
|
@ -286,22 +290,22 @@ function print_help()
|
|||
Commands:
|
||||
|
||||
<Navigation>
|
||||
(G)o to url
|
||||
(V)iew link (by id)
|
||||
(B)ack
|
||||
(F)orward
|
||||
(R)eload current file
|
||||
(G)o to url
|
||||
(R)eload current address
|
||||
(V)iew link/bookmark
|
||||
|
||||
<Bookmarks>
|
||||
(A)dd bookmark for current page
|
||||
(A)dd bookmark
|
||||
(D)elete bookmark
|
||||
(L)ist bookmarks
|
||||
(U)pdate bookmark (by id)
|
||||
(D)elete bookmark (by id)
|
||||
(U)pdate bookmark title
|
||||
|
||||
<System>
|
||||
(H)elp
|
||||
(S)ave file as...
|
||||
(Q)uit Stubb
|
||||
(S)ave file to disk
|
||||
]]
|
||||
print(helpstring)
|
||||
end
|
||||
|
@ -397,19 +401,18 @@ function show_favorites()
|
|||
for i, v in ipairs(session.favorites) do
|
||||
print(string.format(' (f%d) %s', i, v.display))
|
||||
end
|
||||
print(separator)
|
||||
print('\n' .. separator)
|
||||
end
|
||||
|
||||
|
||||
function save_favorites()
|
||||
local file = io.open(save_file_location, 'w+')
|
||||
io.output(file)
|
||||
io.write("session.favorites = {\n")
|
||||
file:write("session.favorites = {\n")
|
||||
for _,v in ipairs(session.favorites) do
|
||||
io.write(string.format(" {[%q] = %q, [%q] = %q},\n", 'display', v.display, 'link', v.link))
|
||||
file:write(string.format(" {[%q] = %q, [%q] = %q},\n", 'display', v.display, 'link', v.link))
|
||||
end
|
||||
io.write("}\n")
|
||||
io.close(file)
|
||||
file:write("}\n")
|
||||
file:close()
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue