add initial files

main
Rob Muhlestein 10 months ago
parent 2ae56ddc42
commit 5f13b036f9

@ -0,0 +1,6 @@
# Get `lynx` and setup from SKILSTAK Beginner Boost
## Repo considerations
Note that the `lynx`, `lynx.lss` and `lynx.cfg` are UNIX hard links and may not appear as such in clones.

@ -0,0 +1,71 @@
package main
import (
_ "embed"
"fmt"
"os"
"path/filepath"
Z "github.com/rwxrob/bonzai/z"
"github.com/rwxrob/choose"
"github.com/rwxrob/fs/dir"
"github.com/rwxrob/fs/file"
)
//go:embed lynx.lss
var lss string // styles and colors that go with gruvbox terminal theme
//go:embed lynx.cfg
var cfg string // vim-based configurations for lynx
//go:embed lynx
var lynx string // handles environment variable setup but still finds lynx binary
var Cmd = &Z.Cmd{
Call: func(_ *Z.Cmd, _ ...string) error {
// create ~/.config/lynx if not exists
confdir, err := os.UserConfigDir()
if err != nil {
return err
}
target := filepath.Join(confdir, `lynx`)
if !dir.Exists(target) {
err := dir.Create(target)
if err != nil {
return err
}
}
// write the lss and cfg files to dir
cfgpath := filepath.Join(target, `lynx.cfg`)
if err := file.Overwrite(cfgpath, cfg); err != nil {
return err
}
fmt.Printf("lynx.cfg written to %v\n", cfgpath)
lsspath := filepath.Join(target, `lynx.lss`)
if err := file.Overwrite(lsspath, lss); err != nil {
return err
}
fmt.Printf("lynx.lss written to %v\n", lsspath)
// copy the lynx script to the path location specified
path := filepath.SplitList(os.Getenv(`PATH`))
fmt.Println(`Which path should we put the binaries in? (You must have access.)`)
_, target, err = choose.From(path)
if err != nil {
return err
}
lynxpath := filepath.Join(target, `lynx`)
if err := file.Overwrite(lynxpath, lynx); err != nil {
return err
}
fmt.Printf("lynx written to %v\n", lynxpath)
err = os.Chmod(lynxpath, 0700)
if err != nil {
return err
}
return nil
},
}

@ -0,0 +1,26 @@
#!/usr/bin/env bash
# be sure to install the ca-certificates package
# see ../lynx/README.md for configs
lynxpath=/usr/bin/lynx
[[ ! -x $lynxpath ]] && lynxpath=/usr/local/bin/lynx
useragent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.79 Safari/537.1 Lynx"
if [ -e "$HOME/.config/lynx/lynx.cfg" ];then
export LYNX_CFG="$HOME/.config/lynx/lynx.cfg"
fi
if [ -e "$HOME/.config/lynx/lynx.lss" ];then
export LYNX_LSS="$HOME/.config/lynx/lynx.lss"
fi
if [ ! -x "$lynxpath" ]; then
echo "Doesn't look like lynx is installed."
exit 1
fi
exec "$lynxpath" --useragent="$useragent" "$@"

File diff suppressed because it is too large Load Diff

@ -0,0 +1,116 @@
# Setting the normal and default types lets us keep (almost) the same colors
# whether the terminal's default colors are white-on-black or black-on-white.
# It is not exact since the default "white" is not necessarily the same color
# as the ANSI lightgray, but is as close as we can get in a standard way.
#
# If you really want the terminal's default colors, and if lynx is built using
# ncurses' default-color support, remove these two lines:
#normal: normal: lightgray:black
#default: normal: white:black
# Normal type styles correspond to HTML tags.
#
# The next line (beginning with "em") means: use bold if mono, otherwise
# brightblue on <defaultbackground>
em: bold: brightblue
strong: bold: brightred
b: bold: red
i: bold: brightblue
a: bold: green
img: dim: brown
fig: normal: gray
caption: reverse: brown
hr: normal: yellow
blockquote: normal: brightblue
ul: normal: brown
address: normal: magenta
title: normal: magenta
tt: dim: brightmagenta: black
h1: bold: white: blue
label: normal: magenta
q: normal: yellow: magenta
small: dim: default
big: bold: yellow
sup: bold: yellow
sub: dim: gray
li: normal: magenta
code: normal: cyan
cite: normal: cyan
table: normal: brightcyan
tr: bold: brown
td: normal: default
br: normal: default
# Special styles - not corresponding directly to HTML tags
# alert - status bar, when message begins "Alert".
# alink - active link
# normal - default attributes
# status - status bar
# whereis - whereis search target
#
#normal:normal:default:blue
alink: reverse: yellow: black
status: reverse: cyan: default
alert: bold: yellow: red
#whereis: reverse+underline: magenta: cyan
whereis: bold+reverse: black: yellow
# currently not used
#value:normal:green
menu.bg: normal: black: lightgray
menu.frame: normal: black: lightgray
menu.entry: normal: lightgray: black
menu.n: normal: red: gray
menu.active: normal: yellow: black
menu.sb: normal: brightred: lightgray
forwbackw.arrow:reverse
hot.paste: normal: brightred: gray
# Styles with classes - <ul class=red> etc.
ul.red: underline: brightred
ul.blue: bold: brightblue
li.red: reverse: red: yellow
li.blue: bold: blue
strong.a: bold: black: red
em.a: reverse: black: blue
strong.b: bold: white: red
em.b: reverse: white: blue
strong.debug: reverse: green
font.letter: normal: white: blue
input.submit: normal: cyan
tr.baone: bold: yellow
tr.batwo: bold: green
tr.bathree: bold: red
#
# Special handling for link.
link: normal: white
link.green: bold: brightgreen
link.red: bold: black: red
link.blue: bold: white: blue
link.toc: bold: black: white
# Special cases for link - the rel or title is appended after the class.
# <link rel=next class=red href="1">
link.red.next: bold: red
link.red.prev: bold: yellow: red
link.blue.prev: bold: yellow: blue
link.blue.next: bold: blue
link.green.toc: bold: white: green
#
# Define styles that will be used when syntax highlighting is requested
# (commandline option -prettysrc).
span.htmlsrc_comment:normal: white
span.htmlsrc_tag:normal: white
#If you don't like that the tag name and attribute name are displayed
#in different colors, comment the following line.
span.htmlsrc_attrib:normal: cyan
span.htmlsrc_attrval:normal: magenta
span.htmlsrc_abracket:normal: white
span.htmlsrc_entity:normal: white
##span.htmlsrc_href:
##span.htmlsrc_entire:
span.htmlsrc_badseq:normal: red
span.htmlsrc_badtag:normal: red
span.htmlsrc_badattr:normal: red
span.htmlsrc_sgmlspecial:normal: yellow

@ -0,0 +1,5 @@
package main
func main() {
Cmd.Run()
}
Loading…
Cancel
Save