1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-06-24 00:17:11 -07:00

add empty docstrings for most of the remaining functions

This commit is contained in:
Connor Olding 2021-07-30 19:41:16 -07:00
parent 74ec57f2fa
commit 0439a5a4e8
21 changed files with 23 additions and 23 deletions

2
sh/bak
View File

@ -3,7 +3,7 @@
# YES_BASH
# YES_DASH
bak() {
bak() { ### @-
[ $# -gt 0 ] || { printf "%s\n" "$0: too few arguments" >&2; return 1; }
local ret=0
for f; do

View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh
# YES_ZSH
baknow() {
baknow() { ### @-
cp -ip "${1:?missing file argument}" "$1.$(now "$1").bak"
}

View File

@ -7,7 +7,7 @@
#. ~/sh/note # FIXME: don't do this?
: $((SOURCING-=1))
baks() { # backup, timestamped
baks() { ### @-
local ret=0
for fp; do
local now="$(date -u '+%y-%m-%d_%H-%M-%S')"

4
sh/bin
View File

@ -3,9 +3,9 @@
# YES_BASH
# YES_DASH
bin() {
bin() { ### @-
local a="$(($@))"
a="$(((((((((((((((a + 0x0FFFFF80) & 0x1000007F) + 0x00FFFFC0) & 0x1100003F) + 0x000FFFE0) & 0x1110001F) + 0x0000FFF0) & 0x1111000F) + 0x00000FF8) & 0x11111007) + 0x000000FC) & 0x11111103) + 0x0000000E) & 0x11111111))"
a="$(( (((((((((((((a + 0x0FFFFF80) & 0x1000007F) + 0x00FFFFC0) & 0x1100003F) + 0x000FFFE0) & 0x1110001F) + 0x0000FFF0) & 0x1111000F) + 0x00000FF8) & 0x11111007) + 0x000000FC) & 0x11111103) + 0x0000000E) & 0x11111111 ))"
printf "%08X\n" "$a"
}

View File

@ -3,7 +3,7 @@
# YES_BASH
# YES_DASH
countdiff() {
countdiff() { ### @-
[ $# -gt 1 ] || { printf "%s\n" "$0: too few arguments" >&2; return 1; }
[ $# -le 2 ] || { printf "%s\n" "$0: too many arguments" >&2; return 1; }
git --no-pager diff --stat --no-color --no-index "$1" "$2" \

View File

@ -3,7 +3,7 @@
# NO_BASH
# NO_DASH
cutv() {
cutv() { ### @-
[ $# -le 4 ] || { printf "%s\n" "$0: too many arguments" >&2; return 1; }
local nel="${1?missing length parameter}"
local f="${2?missing file parameter}"

View File

@ -3,8 +3,8 @@
# YES_BASH
# YES_DASH
echo2() {
local IFS=" "
echo2() { ### @-
local IFS=' '
printf "%s\n" "$*" >&2
}

View File

@ -3,7 +3,7 @@
# YES_BASH
# YES_DASH
explore() {
explore() { ### @-
[ -n "$MSYSTEM" ] || { printf "%s\n" "$0: only for MSYS2" >&2; return 1; }
[ $# -le 1 ] || { printf "%s\n" "$0: too many arguments" >&2; return 1; }
explorer "$(cygpath -w "${1:-.}")"

2
sh/ff
View File

@ -3,7 +3,7 @@
# YES_BASH
# YES_DASH
ff() {
ff() { ### @-
[ $# -le 1 ] || { printf "%s\n" "$0: too many arguments" >&2; return 1; }
find "${1:-.}" -type f | fzy
}

View File

@ -6,7 +6,7 @@
# YES_BASH
# YES_DASH
ghmd() {
ghmd() { ### @-
# CSS via: https://github.com/sindresorhus/github-markdown-css
# <link href="//cdnjs.cloudflare.com/ajax/libs/octicons/2.1.2/octicons.css" 'media="all" rel="stylesheet" type="text/css" />
printf '%s' '<!DOCTYPE html><html><head><meta charset="utf-8"><link ' \

View File

@ -3,7 +3,7 @@
# YES_BASH
# YES_DASH
maybesudo_() {
maybesudo_() { ### @-
local name
local env_cleanup=0
while getopts :AEHKPSVbhiklnsvC:U:g:p:r:t:u: name; do

View File

@ -3,7 +3,7 @@
# YES_BASH
# YES_DASH
note() {
note() { ### @-
local IFS=" "
printf "\033[1m%s\033[0m\n" "$*" >&2
}

View File

@ -5,7 +5,7 @@
# TODO: source pippy here? this may affect dash compatibility.
pegg() {
pegg() { ### @-
[ $# -ge 2 ] || { printf "%s\n" "$0: too few arguments" >&2; return 1; }
pippy "https://github.com/$1/$2/tarball/${3:-master}#egg=$2"
}

View File

@ -4,7 +4,7 @@
#. ~/sh/maybesudo
#. ~/sh/has
pippy() {
pippy() { ### @-
local sudo="$(has sudo || echo maybesudo_)"
"$sudo" py -m pip install --upgrade --upgrade-strategy only-if-needed "$@"
}

View File

@ -3,7 +3,7 @@
# YES_BASH
# YES_DASH
psbm() {
psbm() { ### @-
[ -z "$MSYSTEM" ] || { printf "%s\n" "$0: unsupported on MSYS2" >&2; return 1; }
ps axco rss,pid,command | awk '
NR>1&&$1>0{t+=$1;printf("%8.2fM %7d %s\n",$1/1024,$2,$3)}

View File

@ -3,7 +3,7 @@
# YES_BASH
# YES_DASH
refresh() {
refresh() { ### @-
hash -r
}

View File

@ -3,7 +3,7 @@
# YES_BASH
# YES_DASH
similar() {
similar() { ### @-
[ $# -eq 0 ] || { printf "%s\n" "$0: does not take arguments" >&2; return 1; }
awk '
{

View File

@ -4,7 +4,7 @@
#. ~/sh/echo2 # FIXME
#. ~/sh/note # FIXME
stfu() {
stfu() { ### @-
# NOTE: don't use stfu for handling sensitive data or commands!
# use it for 7zip.
[ $# -gt 0 ] || { printf "%s\n" "$0: too few arguments" >&2; return 1; }

2
sh/sum
View File

@ -3,7 +3,7 @@
# YES_BASH
# YES_DASH
sum() {
sum() { ### @-
local sum=0
for i; do
: $((sum+=i))

View File

@ -3,7 +3,7 @@
# YES_BASH
# YES_DASH
trash() {
trash() { ### @-
[ $# -le 1 ] || { printf "%s\n" "$0: too many arguments" >&2; return 1; }
dd status=none if=/dev/random bs=1 count="${1:?missing count argument}"
}

2
sh/wat
View File

@ -5,7 +5,7 @@
# wat - a better and recursive which/whence
# via: https://leahneukirchen.org/dotfiles/tools.html
wat() {
wat() { ### @-
( # constrain unalias
for cmd; do
if (( $+aliases[$cmd] )); then