diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2022-03-26 19:31:39 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2022-03-26 19:31:39 +1300 |
commit | 945a9583d7e66f7489d7902b50d35a7235d122c8 (patch) | |
tree | 41a1eb2789ad28688d626c144fb6aad7828783b0 | |
parent | Merge branch 'release/v11.13.0' (diff) | |
parent | Update dotfiles(7) manual page (diff) | |
download | dotfiles-945a9583d7e66f7489d7902b50d35a7235d122c8.tar.gz dotfiles-945a9583d7e66f7489d7902b50d35a7235d122c8.zip |
Merge branch 'release/v11.14.0'v11.14.0
* release/v11.14.0:
Update dotfiles(7) manual page
Add Torsocks management function `tor`
Shorten some long lines in path.sh
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | man/man7/dotfiles.7df | 3 | ||||
-rw-r--r-- | sh/shrc.d/path.sh | 8 | ||||
-rw-r--r-- | sh/shrc.d/tor.sh | 33 |
5 files changed, 45 insertions, 5 deletions
@@ -249,6 +249,8 @@ in `sh/shrc.d` to be loaded by any POSIX interactive shell. Those include: - `scp()` tries to detect forgotten hostnames in `scp(1)` command calls. - `sudo()` forces `-H` for `sudo(8)` calls so that `$HOME` is never preserved; I hate having `root`-owned files in my home directory. +- `tor()` is just a terse shortcut for using Torsocks to anonymize TCP + connections from the current shell. - `tree()` colorizes GNU `tree(1)` output if possible (without having `LS_COLORS` set). - `x()` is a one-key shortcut for `exec startx`. @@ -1,2 +1,2 @@ -tejr dotfiles v11.13.0 -Sat, 26 Mar 2022 04:31:22 +0000 +tejr dotfiles v11.14.0 +Sat, 26 Mar 2022 06:31:37 +0000 diff --git a/man/man7/dotfiles.7df b/man/man7/dotfiles.7df index 73055a24..ea6d3080 100644 --- a/man/man7/dotfiles.7df +++ b/man/man7/dotfiles.7df @@ -379,6 +379,9 @@ command calls. \f[C]$HOME\f[R] is never preserved; I hate having \f[C]root\f[R]-owned files in my home directory. .IP \[bu] 2 +\f[C]tor()\f[R] is just a terse shortcut for using Torsocks to anonymize +TCP connections from the current shell. +.IP \[bu] 2 \f[C]tree()\f[R] colorizes GNU \f[C]tree(1)\f[R] output if possible (without having \f[C]LS_COLORS\f[R] set). .IP \[bu] 2 diff --git a/sh/shrc.d/path.sh b/sh/shrc.d/path.sh index a854e148..812f5f0f 100644 --- a/sh/shrc.d/path.sh +++ b/sh/shrc.d/path.sh @@ -130,7 +130,7 @@ path(): Manage contents of PATH variable USAGE: path [list] - Print the current directories in PATH, one per line (default command) + Print the current directories in PATH, one per line (default) path insert [DIR] Add directory DIR (default $PWD) to the front of PATH path append [DIR] @@ -142,7 +142,7 @@ USAGE: path pop Remove the last directory from PATH path check [DIR] - Return whether directory DIR (default $PWD) is a component of PATH + Return whether directory DIR (default $PWD) is in PATH path help Print this help message EOF @@ -150,7 +150,9 @@ EOF # Command not found *) - printf >&2 'path(): %s: Unknown command (try "help")\n' "$1" + printf >&2 \ + 'path(): %s: Unknown command (try "help")\n' \ + "$1" return 2 ;; esac diff --git a/sh/shrc.d/tor.sh b/sh/shrc.d/tor.sh new file mode 100644 index 00000000..e6e31341 --- /dev/null +++ b/sh/shrc.d/tor.sh @@ -0,0 +1,33 @@ +# Manage Torsocks for the current shell +tor() { + + # Check first argument to figure out operation + case $1 in + + # Show whether Torsocks + show|'') + case $LD_PRELOAD: in + (*/libtorsocks.so:*) + printf 'on\n' + ;; + (*) + printf 'off\n' + ;; + esac + ;; + + # Turn Torsocks on or off + on|off) + command -v torsocks >/dev/null 2>&1 || return + . "$(command -v torsocks)" + ;; + + # Command not found + *) + printf >&2 \ + 'tor(): %s: Unknown command (try "help")\n' \ + "$1" + return 2 + ;; + esac +} |