Skip to content

Commit

Permalink
spellcheck, fixes, improvements
Browse files Browse the repository at this point in the history
- choose: add `--truncate-body` WIP
- config-edit: `--editer=` to `--editor=`
- add `echo-truncate-lines` WIP
- eval-helper: shapeshifter will be enabled on `sudo-helper` by default
- flush-dns, setup-util-docker, setup-util-xcode: fix formatting when sudo needed
- fs-rm: rewrote for new `fs-trim` command
- get-profile: `possesive-pronoun` to `possesive-pronoun`
- git-helper: fix bad formatting on failures
- is-present: speedier sudo checks, by first checking without sudo
- sudo-helper: support `--optional` for speedier checks without sudo
- mount-helper: fixed detection of forced unmount
- add `setup-util-tor-browser`
- styles: fix terminal title and resize not terminating
  • Loading branch information
balupton committed Nov 27, 2024
1 parent ccda6c8 commit 25fa014
Show file tree
Hide file tree
Showing 136 changed files with 1,754 additions and 792 deletions.
27 changes: 15 additions & 12 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# https://features.trunk.io/check/p/trunk-doesnt-work-in-nested-repo
version: 0.1
cli:
version: 1.21.0
version: 1.22.8
plugins:
sources:
- id: trunk
ref: v1.4.5
ref: v1.6.5
uri: https://github.com/trunk-io/plugins
runtimes:
enabled:
- node@18.12.1
- go@1.21.0
- python@3.10.8
# - node@18.12.1 <-- there's only a single Node.js file: echo-url-coder.js
Expand All @@ -20,20 +21,22 @@ actions:
- trunk-upgrade-available
lint:
enabled:
- actionlint@1.6.27
- black@24.3.0
- checkov@3.2.48
- flake8@7.0.0
- cspell@8.16.0
- bandit@1.7.10
- actionlint@1.7.4
- black@24.10.0
- checkov@3.2.314
- flake8@7.1.1
- git-diff-check@SYSTEM
- gitleaks@8.18.2
- gitleaks@8.21.2
- isort@5.13.2
- markdownlint@0.39.0
- prettier@3.2.5
- ruff@0.3.4
- markdownlint@0.43.0
- prettier@3.4.0
- ruff@0.8.0
- shellcheck@0.10.0
- shfmt@3.7.0
- taplo@0.8.1
- trufflehog@3.71.0
- taplo@0.9.3
- trufflehog@3.84.1
- yamllint@1.35.1
disabled:
- eslint # it can't find the bevry config extensions for some reason
Expand Down
23 changes: 3 additions & 20 deletions .vscode/workspace.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,8 @@
}
],
"settings": {
"cSpell.words": [
"balupton",
"Bash",
"Builtins",
"doas",
"dotfile",
"dotfiles",
"Mageia",
"molleweide",
"pacman",
"POSIX",
"Roadmap",
"Subshells",
"sumitrai",
"xbps",
"Xonsh",
"Zsh",
"Bevry"
],
"deno.enable": true
"prettier.enable": false,
"cSpell.enabled": true,
"deno.enable": true
}
}
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

Unless stated otherwise all works are:

- Copyright &copy; [Benjamin Lupton](https://balupton.com)
- Copyright &copy; [Benjamin Lupton](https://balupton.com)

and licensed under:

- [Reciprocal Public License 1.5](http://spdx.org/licenses/RPL-1.5.html)
- [Reciprocal Public License 1.5](http://spdx.org/licenses/RPL-1.5.html)

## Reciprocal Public License 1.5 (RPL1.5)

Expand Down
260 changes: 130 additions & 130 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion commands.beta/echo-mkdir
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function echo_mkdir() (
'--no-sudo'* | '--sudo'*)
option_sudo="$(get-flag-value --affirmative --fallback="$option_sudo" -- "$item")"
;;
# forward to stdinargs, however support mixing and matching of our options, with stdinarg options
# forward to stdinargs, however support mixing and matching of our options, with stdinargs options
'--')
option_args+=("$item" "$@")
shift $#
Expand Down
2 changes: 1 addition & 1 deletion commands.beta/echo-revolving-screen
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function echo_revolving_screen() (
function help {
cat <<-EOF >/dev/stderr
ABOUT:
Continously clear the output of a command, showing only the latest output, then clearing it upon completion.
Continuously clear the output of a command, showing only the latest output, then clearing it upon completion.
USAGE:
(echo-lines -- 1 2; sleep 2; echo-lines -- 3 4; sleep 2) | echo-revolving-door [...options]
Expand Down
2 changes: 1 addition & 1 deletion commands.beta/echo-sort
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function echo_sort() (
2
3
ALTERATIVES:
ALTERNATIVES:
# use [sort] directly for more advanced usage
echo-lines -- 3 2 1 | sort
Expand Down
2 changes: 1 addition & 1 deletion commands.beta/echo-with-empty-fallback
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function echo_with_empty_fallback() (
case "$item" in
'--help' | '-h') help ;;
'--fallback='*) option_fallback="${item#*=}" ;;
# forward to stdinargs, however support mixing and matching of our options, with stdinarg options
# forward to stdinargs, however support mixing and matching of our options, with stdinargs options
'--')
option_args+=("$item" "$@")
shift $#
Expand Down
2 changes: 1 addition & 1 deletion commands.beta/echo-with-whitespace-fallback
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function echo_with_whitespace_fallback() (
case "$item" in
'--help' | '-h') help ;;
'--fallback='*) option_fallback="${item#*=}" ;;
# forward to stdinargs, however support mixing and matching of our options, with stdinarg options
# forward to stdinargs, however support mixing and matching of our options, with stdinargs options
'--')
option_args+=("$item" "$@")
shift $#
Expand Down
2 changes: 1 addition & 1 deletion commands.beta/icloud-helper
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function icloud_helper() (
for path in "$@"; do
# .DS_Store files are not added to iCloud Drive
# .icloud files are placeholders for non-local files
# .screenflow does not play niceley with iCloud Drive, as it is a secret directory
# .screenflow does not play nicely with iCloud Drive, as it is a secret directory
if [[ ! -d $path && $path != *".DS_Store" && $path != *".icloud" ]]; then
if [[ $path == *".screenflow"* || $path == *".sketch"* ]]; then
__print_lines "skipped $path, as it is a directory in disguise as a file, and can only evict files"
Expand Down
4 changes: 2 additions & 2 deletions commands.beta/is-nonempty-file
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ function is_nonempty_file_test() (
-- is-nonempty-file -- '' ''

eval-tester --name='missing' --status=9 \
-- is-nonempty-file -- "$DOROTHY/this-doesnt-exist"
-- is-nonempty-file -- "$DOROTHY/this-does-not-exist"

eval-tester --name='empty dirs' --status=9 \
-- is-nonempty-file -- "$dir" "$dir"

eval-tester --name='empty files' --status=1 \
eval-tester --name='empty files' --status=1 \
-- is-nonempty-file -- "$file" "$file"

eval-tester --name='non-empty dir' --status=9 \
Expand Down
2 changes: 1 addition & 1 deletion commands.beta/is-password-usable
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function is_password_usable() (
Defaults to the current user.
QUIRKS:
Note that $(echo-style --code='usermod -L [user]') which is used to make the user only a share-user (not login), will cause the passsword status to become locked L, and thus return failure.
Note that $(echo-style --code='usermod -L [user]') which is used to make the user only a share-user (not login), will cause the password status to become locked L, and thus return failure.
EOF
if [[ $# -ne 0 ]]; then
echo-error "$@"
Expand Down
2 changes: 1 addition & 1 deletion commands.beta/is-shapeshifter
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function is_shapeshifter() (
'--no-quiet'* | '--quiet'*)
option_quiet="$(get-flag-value --affirmative --fallback="$option_quiet" -- "$item")"
;;
# forward to stdinargs, however support mixing and matching of our options, with stdinarg options
# forward to stdinargs, however support mixing and matching of our options, with stdinargs options
'--')
option_args+=("$item" "$@")
shift $#
Expand Down
8 changes: 4 additions & 4 deletions commands.beta/setup-server
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ function setup_server() (
# VPN

function verify_nordvpn_killswitch {
# verify firewall, this is curcial for killswitch to work
# verify firewall, this is crucial for killswitch to work
nordvpn set firewall on || : # or to prevent already enabled errors
waiter 5 # this can take a while for changes to be reflected
if ! nordvpn settings | echo-wait | grep --quiet --fixed-strings --regexp='Firewall: enabled'; then
Expand Down Expand Up @@ -561,7 +561,7 @@ function setup_server() (
# nordvpn whitelist add port "$nordvpn_port"
# done

# verify that killswitch i spossible
# verify that killswitch is possible
verify_nordvpn_killswitch

# attempt nordvpn connect
Expand All @@ -576,7 +576,7 @@ function setup_server() (
}
waiter 60

# verify that connetion and killswitch work
# verify that connection and killswitch work
verify_nordvpn_connection
fi

Expand Down Expand Up @@ -612,7 +612,7 @@ function setup_server() (
echo-style --success='Reconnected to NordVPN.'

echo-style --notice='Resuming dependent services:'
# the [|| :] is to that we resume, rather than start, as the service may be dependent on another service such as samba or a mount, this functinality is more just for temporary vpn disconnections/reconnections
# the [|| :] is to that we resume, rather than start, as the service may be dependent on another service such as samba or a mount, this functionality is more just for temporary vpn disconnections/reconnections
service-helper --start --ignore -- "${services_vpn_dependent[@]}" || :
echo-style --success='Resumed dependent services.'
else
Expand Down
2 changes: 1 addition & 1 deletion commands.beta/twitter-helper
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function twitter_helper() (
ACTIONS:
advertisers [twitter_advertiser_list.pdf]
Extract sthe usernames from the list of advertisers.
Extracts the usernames from the list of advertisers.
Fetch the list from: https://twitter.com/settings/your_twitter_data/audiences
block ...<username>
Expand Down
2 changes: 1 addition & 1 deletion commands.beta/ytd-helper
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function ytd_helper() (
The URL to download the video from.
--tool=<tool>
The tool to actually invoke, defaults to [ytd-dl] or [youtube-dl] based on avaliability.
The tool to actually invoke, defaults to [ytd-dl] or [youtube-dl] based on availability.
-- [... tool options]
Forward to the invoked <tool>. Refer to [youtube-dl --help].
Expand Down
8 changes: 4 additions & 4 deletions commands.deprecated/echo-quiet-enabled
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/usr/bin/env bash

function echo_quier_enabled() (
function echo_quiet_enabled() (
source "$DOROTHY/sources/bash.bash"
dorothy-warnings add --code='echo-quier-enabled' --bold=' has been deprecated in favor of ' --code='get-terminal-quier-support'
dorothy-warnings add --code='echo-quiet-enabled' --bold=' has been deprecated in favor of ' --code='get-terminal-quiet-support'

# =====================================
# Action

get-terminal-quier-support
get-terminal-quiet-support
)

# fire if invoked standalone
if [[ $0 == "${BASH_SOURCE[0]}" ]]; then
echo_quier_enabled "$@"
echo_quiet_enabled "$@"
fi
2 changes: 1 addition & 1 deletion commands.deprecated/is-array-count-ge
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function is_array_count_ge() (
OPTIONS:
<size> | --size=<size>
How many elements to expect at aminimum.
How many elements to expect at a minimum.
<element>
An element of the array.
Expand Down
2 changes: 1 addition & 1 deletion commands.deprecated/is-array-empty
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# failure if any value is truthy
# pass if all values are empty

# if you are using this in conjuction with a is-array-partial,
# if you are using this in conjunction with a is-array-partial,
# or your own [[ -n ... ]] or [[ -z ... ]] calls,
# then there is no need for this

Expand Down
2 changes: 1 addition & 1 deletion commands.deprecated/is-array-partial
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function is_array_partial() (
function help {
cat <<-EOF >/dev/stderr
ABOUT:
Check if an array has both empty and non-empty elemnets.
Check if an array has both empty and non-empty elements.
USAGE:
is-array-full [--] ...<element>
Expand Down
2 changes: 1 addition & 1 deletion commands.deprecated/is-empty-string
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ function is_empty_string() (

# fire if invoked standalone
if [[ $0 == "${BASH_SOURCE[0]}" ]]; then
is_empty_string "$@"
is_empty_string "$@"
fi
12 changes: 6 additions & 6 deletions commands/ask
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# read can set the default with [-i <default>] however that requries [-e] which uses readline, which requires stdin to not be programmatic
# read can set the default with [-i <default>] however that requires [-e] which uses readline, which requires stdin to not be programmatic
#
# if stdin is programmatic (ssh -T, CI, piped) then read behaves differently:
# [-p <prompt>] is discarded, no prompt is shown
Expand Down Expand Up @@ -82,7 +82,7 @@ function ask_test() (
# confirm the provided value
sleep 3
__print_line
} | eval-tester --name='receuve a custom response, by sending the custon response to overwrite the default, and then confirming the custom response' --stdout='a custom response' \
} | eval-tester --name='receive a custom response, by sending the custom response to overwrite the default, and then confirming the custom response' --stdout='a custom response' \
-- ask --question='What is your response?' --default='a default response' --confirm

# @todo add tests for timout
Expand Down Expand Up @@ -393,7 +393,7 @@ function ask_() (
# have we prompted?
if [[ $ASKED == 'no' ]]; then
# do we want to confirm the default value
# adding a [&& -t 0] will cause stdin input to always be respected, which is inconsistent with expecations, e.g.
# adding a [&& -t 0] will cause stdin input to always be respected, which is inconsistent with expectations, e.g.
# echo 'overwrite' | { ask --linger --default='d1' --skip-default --question='q1'; ask --linger --default='d2' --skip-default --question='q2' )
# should output 'd1' and 'overwrite', not 'overwrite' and 'd2', as the goal of skip-default is to use the default preference for performance and intuition reasons
if is-value -- "$RESULT" && [[ $option_confirm_default == 'no' ]]; then
Expand Down Expand Up @@ -439,14 +439,14 @@ function ask_() (
return "$choose_status"
fi

# proceess the confirmation
# process the confirmation
if [[ $choice == 'existing' ]]; then
# done, sucess
# done, success
return 0
elif [[ $choice == 'custom' ]]; then
: # proceed with prompt
elif [[ $choice == 'none' ]]; then
# done, sucess
# done, success
RESULT=''
return 0
else
Expand Down
2 changes: 1 addition & 1 deletion commands/btrfs-helper
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ function btrfs_helper() (
# --background|--bg run the balance as a background process
# --enqueue wait if there's another exclusive operation running, otherwise continue
# -d[filters] act on data chunks with optional filters (no space in between)
# -m[filters] act on metadata chunks with optinal filters (no space in between)
# -m[filters] act on metadata chunks with optional filters (no space in between)
# -s[filters] act on system chunks (only under -f) with optional filters (no space in between)
if [[ $strategy == 'single' ]]; then
args+=('--force')
Expand Down
Loading

0 comments on commit 25fa014

Please sign in to comment.