Changed the stash format
This commit is contained in:
@@ -13,7 +13,7 @@ Improvements over the original Bopher from that post:
|
|||||||
- mouse support (where possible)
|
- mouse support (where possible)
|
||||||
- smoother rendering and scrolling
|
- smoother rendering and scrolling
|
||||||
- better edge-case stability (e.g. on macOS where using file descriptor 3 actually crashes everything)
|
- better edge-case stability (e.g. on macOS where using file descriptor 3 actually crashes everything)
|
||||||
- better Gophermap processing according to the RFC
|
- better Gophermap processing according to the RFC1436
|
||||||
- multi-level navigation history (although you can only go back)
|
- multi-level navigation history (although you can only go back)
|
||||||
- status bar with currently opened resource name
|
- status bar with currently opened resource name
|
||||||
- ability to accept `gopher://` URLs from the command line
|
- ability to accept `gopher://` URLs from the command line
|
||||||
@@ -27,6 +27,8 @@ Improvements over the original Bopher from that post:
|
|||||||
- `stty` (to fetch current terminal size in rows and columns)
|
- `stty` (to fetch current terminal size in rows and columns)
|
||||||
- `date` (to shape entry timestamps when stashing links)
|
- `date` (to shape entry timestamps when stashing links)
|
||||||
|
|
||||||
|
This Bopher-NG repo also contains a set of useful tools (also written in pure Bash) to ease authoring and publishing your own Gopher content. See the [Bopher Tools README](tools/README-tools.md) for more information.
|
||||||
|
|
||||||
## Which Bash versions are supported?
|
## Which Bash versions are supported?
|
||||||
|
|
||||||
Bopher-NG was only tested on Bash 5.1, but should support any version from 4.2 and up.
|
Bopher-NG was only tested on Bash 5.1, but should support any version from 4.2 and up.
|
||||||
@@ -75,7 +77,7 @@ No. Besides the ambiguity problem, it will also introduce huge external dependen
|
|||||||
|
|
||||||
## What is the link stash?
|
## What is the link stash?
|
||||||
|
|
||||||
Link stash is a viable and interoperable alternative to both bookmarks and clipboard that can be implemented with pure Bash. Essentially, it's an append-only text file at a fixed location (`~/.bopher-links.txt` by default) where the user can instruct Bopher-NG to save the link to the currently viewed resource. For your convenience, links are stashed with a UTC-based timestamp and in the `gopher://` format, so they can be copied from the file later and used in other browsers.
|
Link stash is a viable and interoperable alternative to both bookmarks and clipboard that can be implemented with pure Bash. Essentially, it's an append-only text file at a fixed location (`~/.bopher-links.txt` by default) where the user can instruct Bopher-NG to save the link to the currently viewed resource. For your convenience, links are stashed with a UTC-based timestamp and in the `gopher://` format, so they can be copied from the file later and used in other browsers. As of now, every stash file line is a valid Gophermap line, so can easily share your findings on the Gopherspace if you need to.
|
||||||
|
|
||||||
You can override the `BOPHER_LINKSTASH` environment variable to change the location and name of this file if you need to.
|
You can override the `BOPHER_LINKSTASH` environment variable to change the location and name of this file if you need to.
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -7,7 +7,7 @@
|
|||||||
# - mouse support
|
# - mouse support
|
||||||
# - smoother rendering and scrolling
|
# - smoother rendering and scrolling
|
||||||
# - better edge-case stability
|
# - better edge-case stability
|
||||||
# - better Gophermap processing according to the RFC
|
# - better Gophermap processing according to the RFC1436
|
||||||
# - multi-level navigation history (although you can only go back)
|
# - multi-level navigation history (although you can only go back)
|
||||||
# - status bar with currently opened resource name
|
# - status bar with currently opened resource name
|
||||||
# - ability to accept gopher:// URLs from the command line
|
# - ability to accept gopher:// URLs from the command line
|
||||||
@@ -269,8 +269,11 @@ goback() { # remove the last AM line from history and go there
|
|||||||
|
|
||||||
stashlink() { # stash the link to the currently viewed resource
|
stashlink() { # stash the link to the currently viewed resource
|
||||||
local gopherlink="$(amtogopher "$CURRENTAM")"
|
local gopherlink="$(amtogopher "$CURRENTAM")"
|
||||||
printf '[%s] %s\n' "$(date -u '+%F %T')" "$gopherlink" >> $BOPHER_LINKSTASH
|
readarray -d $'\t' -t fields < <(printf '%s' "$CURRENTAM") # extract individual fields
|
||||||
printf 'Stashed %s%s' "$gopherlink" "$ERESET${ESC}[$TERMROWS;0H" # just reset the cursor to the last line
|
local desc="${fields[1]}"
|
||||||
|
[[ -z "$desc" ]] && desc='Unnamed'
|
||||||
|
printf '%s [%s] %s - %s\t%s\t%s\t%s\r\n' "${fields[5]}" "$(date -u '+%F %T')" "$desc" "$gopherlink" "${fields[4]}" "${fields[2]}" "${fields[3]}" >> $BOPHER_LINKSTASH
|
||||||
|
printf 'Stashed %s - %s%s' "$desc" "$gopherlink" "$ERESET${ESC}[$TERMROWS;0H" # just reset the cursor to the last line
|
||||||
}
|
}
|
||||||
|
|
||||||
# Focus and click a link on a Gophermap
|
# Focus and click a link on a Gophermap
|
||||||
|
|||||||
Reference in New Issue
Block a user