aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-10-19 10:52:31 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-10-19 10:52:31 +1300
commit6622ef2d2bc5df74c991fd6324623c75dbd5ac2d (patch)
treed42ae4a34bae4a4cf80a90f2957db2807a8f085d
parentMerge branch 'master' into openbsd (diff)
parentImprove accuracy of drakon(6df) (diff)
downloaddotfiles-6622ef2d2bc5df74c991fd6324623c75dbd5ac2d.tar.gz
dotfiles-6622ef2d2bc5df74c991fd6324623c75dbd5ac2d.zip
Merge branch 'master' into openbsd
-rw-r--r--.gitignore1
-rw-r--r--Makefile4
-rw-r--r--README.markdown3
-rw-r--r--bash/bashrc.d/completion.bash4
-rw-r--r--bash/bashrc.d/prompt.bash2
-rwxr-xr-xbin/ap34
-rwxr-xr-xbin/bp3
-rw-r--r--games/drakon.awk20
-rw-r--r--[-rwxr-xr-x]games/rot13.sed0
-rw-r--r--man/man1/ap.1df14
-rw-r--r--man/man1/bp.1df17
-rw-r--r--man/man1/br.1df4
-rw-r--r--man/man6/drakon.6df20
m---------vim/bundle/html50
m---------vim/bundle/pathogen0
-rw-r--r--zsh/zshrc.d/prompt.zsh2
16 files changed, 121 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 1e9e814f..96279895 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@ bin/su2d
bin/tot
bin/unf
games/acq
+games/drakon
games/kvlt
games/rot13
games/zs
diff --git a/Makefile b/Makefile
index 0e21851e..252a83d6 100644
--- a/Makefile
+++ b/Makefile
@@ -96,6 +96,7 @@ clean distclean :
bin/tot \
bin/unf \
games/acq \
+ games/drakon \
games/kvlt \
games/rot13 \
games/zs \
@@ -210,7 +211,8 @@ install-finger :
install -pm 0644 -- finger/project "$(HOME)"/.project
install -pm 0644 -- finger/pgpkey "$(HOME)"/.pgpkey
-install-games : games/acq games/kvlt games/rot13 games/zs check-games install-games-man
+install-games : games/acq games/drakon games/kvlt games/rot13 games/zs \
+ check-games install-games-man
install -m 0755 -d -- "$(HOME)"/.local/games
for name in games/* ; do \
[ -x "$$name" ] || continue ; \
diff --git a/README.markdown b/README.markdown
index 66864981..182269a5 100644
--- a/README.markdown
+++ b/README.markdown
@@ -399,12 +399,15 @@ Installed by the `install-bin` target:
* `med(1df)` prints the median.
* `mode(1df)` prints the first encountered mode.
* `tot(1df)` totals the set.
+* `ap(1df)` reads arguments for a given command from the standard input,
+ prompting if appropriate
* `apf(1df)` prepends arguments to a command with ones read from a file,
intended as a framework for shell wrappers or functions.
* `ax(1df)` evaluates an awk expression given on the command line; this is
intended as a quick way to test how Awk would interpret a given expression.
* `bel(1df)` prints a terminal bell character.
* `bl(1df)` generates a given number of blank lines.
+* `bp(1df)` runs `br(1df)` after prompting for an URL
* `br(1df)` launches `$BROWSER`, or a more suitable application for an URL if
it knows of one.
* `ca(1df)` prints a count of its given arguments.
diff --git a/bash/bashrc.d/completion.bash b/bash/bashrc.d/completion.bash
index d2350d61..0d8dbb13 100644
--- a/bash/bashrc.d/completion.bash
+++ b/bash/bashrc.d/completion.bash
@@ -32,8 +32,8 @@ complete -A variable for getopts let read select
complete -A helptopic help
# Jobspecs
-complete -A job disown fg jobs
-complete -A stopped bg
+complete -P '%' -A job disown fg jobs
+complete -P '%' -A stopped bg
# Readline bindings
complete -A binding bind
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index 856e20e6..906b730b 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -93,7 +93,7 @@ prompt() {
{
# Bail if we're not in a work tree--or, implicitly, if we don't
# have git(1).
- [[ -n $(git rev-parse --is-inside-work-tree) ]] ||
+ [[ $(git rev-parse --is-inside-work-tree) == true ]] ||
return
# Refresh index so e.g. git-diff-files(1) is accurate
diff --git a/bin/ap b/bin/ap
new file mode 100755
index 00000000..b6ee36d4
--- /dev/null
+++ b/bin/ap
@@ -0,0 +1,34 @@
+#!/bin/sh
+# Run a program with args read from standard input, prompted if from term
+if [ "$#" -eq 0 ] ; then
+ printf >&2 'ap: Need at least one argument (command name)\n'
+ exit 2
+fi
+
+# Get the command name and shift it off
+cmd=$1
+shift
+
+# Iterate through the remaining args; it's legal for there to be none, but in
+# that case the user may as well just have invoked the command directly
+for arg ; do
+
+ # If this is the first iteration, clear the params away (we grabbed them in
+ # the for statement)
+ if [ -z "$reset" ] ; then
+ set --
+ reset=1
+ fi
+
+ # If stdin is a terminal, prompt with the name of the argument
+ if [ -t 0 ] ; then
+ printf '%s: ' "$arg"
+ fi
+
+ # Note that a whitespace or even empty argument is allowed
+ IFS= read -r val
+ set -- "$@" "$val"
+done
+
+# Execute the command with the given parameters
+exec "$cmd" "$@"
diff --git a/bin/bp b/bin/bp
new file mode 100755
index 00000000..6b78fbbc
--- /dev/null
+++ b/bin/bp
@@ -0,0 +1,3 @@
+#!/bin/sh
+# Read an URL and then browse to it, saving the annoyance of quoting URLs
+ap br URL
diff --git a/games/drakon.awk b/games/drakon.awk
new file mode 100644
index 00000000..e960a6c0
--- /dev/null
+++ b/games/drakon.awk
@@ -0,0 +1,20 @@
+# TyPe lIkE AnDoR DrAkOn fRoM AnCiEnT DoMaInS Of mYsTeRy
+# <http://www.adomgb.info/adomgb-4.html>
+{
+ s = ""
+ u = 0
+ for (i = 1; i <= length($0); i++) {
+ c = substr($0, i, 1)
+ if (c ~ /[a-zA-Z]/) {
+ if (u) {
+ c = toupper(c)
+ }
+ else {
+ c = tolower(c)
+ }
+ u = !u
+ }
+ s = s c
+ }
+ print s
+}
diff --git a/games/rot13.sed b/games/rot13.sed
index 7fb8fac9..7fb8fac9 100755..100644
--- a/games/rot13.sed
+++ b/games/rot13.sed
diff --git a/man/man1/ap.1df b/man/man1/ap.1df
new file mode 100644
index 00000000..bcbc4ce0
--- /dev/null
+++ b/man/man1/ap.1df
@@ -0,0 +1,14 @@
+.TH AP 1df "October 2016" "Manual page for ap"
+.SH NAME
+.B ap
+\- read named arguments from stdin with prompts
+.SH SYNOPSIS
+.B ap PROGRAM ARGNAME1 [ARGNAME2...]
+.SH DESCRIPTION
+.B ap
+runs a program with arguments read from stdin, with an appropriate prompt if
+stdin is a terminal.
+.SH SEE ALSO
+bp(1df), xargs(1)
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>
diff --git a/man/man1/bp.1df b/man/man1/bp.1df
new file mode 100644
index 00000000..49f9de0c
--- /dev/null
+++ b/man/man1/bp.1df
@@ -0,0 +1,17 @@
+.TH BP 1df "October 2016" "Manual page for bp"
+.SH NAME
+.B bp
+\- launch $BROWSER with an URL read from stdin
+.SH SYNOPSIS
+.B bp
+BROWSER=firefox
+.B bp
+.SH DESCRIPTION
+.B bp
+reads an URL from stdin, with an "URL:" prompt if stdin is a terminal, and runs
+br(1df) against it. It was written because the author hates quoting URLs on the
+command line.
+.SH SEE ALSO
+br(1df), ap(1df)
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>
diff --git a/man/man1/br.1df b/man/man1/br.1df
index b20cfc70..af9645fb 100644
--- a/man/man1/br.1df
+++ b/man/man1/br.1df
@@ -1,7 +1,7 @@
.TH BR 1df "August 2016" "Manual page for br"
.SH NAME
.B br
-\- launch "$BROWSER"
+\- launch $BROWSER
.SH SYNOPSIS
.B br
.br
@@ -18,6 +18,6 @@ arguments. That's it.
It was written to have a clean way to launch $BROWSER from ~/.xbindkeysrc. It
has no other reason to exist.
.SH SEE ALSO
-xgo(1df), xgoc(1df)
+bp(1df), xgo(1df), xgoc(1df)
.SH AUTHOR
Tom Ryder <tom@sanctum.geek.nz>
diff --git a/man/man6/drakon.6df b/man/man6/drakon.6df
new file mode 100644
index 00000000..81b2b540
--- /dev/null
+++ b/man/man6/drakon.6df
@@ -0,0 +1,20 @@
+.TH DRAKON 6df "October 2016" "Manual page for drakon"
+.SH NAME
+.B drakon
+\- type like Andor Drakon from Ancient Domains of Mystery
+.SH USAGE
+$
+.B drakon
+/usr/share/dict/words
+.br
+lynx -dump https://sanctum.geek.nz/ |
+.B drakon
+.SH DESCRIPTION
+.B drakon
+emulates a "studlycaps" filter for the text given on standard input that
+resembles the format used for the speech of Andor Drakon, the Elder Chaos God,
+from the highly recommended roguelike game Ancient Domains of Mystery.
+.SH SEE ALSO
+<http://www.adom.de/home/index.html>
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>
diff --git a/vim/bundle/html5 b/vim/bundle/html5
-Subproject fccd580f5f11d576169ee347907c9fbd77af410
+Subproject bc7faabe7a4dfc0d963d6d8a406c3b7284e2866
diff --git a/vim/bundle/pathogen b/vim/bundle/pathogen
-Subproject 8c91196cfd9c8fe619f35fac6f2ac81be10677f
+Subproject 7ba2e1b67a8f8bcbafedaf6763580390dfd9343
diff --git a/zsh/zshrc.d/prompt.zsh b/zsh/zshrc.d/prompt.zsh
index e707f188..ca5ecf3e 100644
--- a/zsh/zshrc.d/prompt.zsh
+++ b/zsh/zshrc.d/prompt.zsh
@@ -61,7 +61,7 @@ prompt() {
{
# Bail if we're not in a work tree--or, implicitly, if we don't
# have git(1).
- [[ -n $(git rev-parse --is-inside-work-tree) ]] ||
+ [[ $(git rev-parse --is-inside-work-tree) == true ]] ||
return
# Refresh index so e.g. git-diff-files(1) is accurate