Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2022 Q1 #121

Merged
merged 136 commits into from
Apr 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
19e2550
add help to `ytd` begun
molleweide Jan 12, 2022
8c6b7b5
prepare more help statements in multiple files from `alias-details`
molleweide Jan 12, 2022
ea69fac
choose-option vim todos
molleweide Jan 13, 2022
2d67585
prepare more helper commands starting from z up until `until-success`
molleweide Jan 13, 2022
42786f4
Merge remote-tracking branch 'origin/master' into add-help
molleweide Jan 21, 2022
8530083
add help to all files from z upuntil unziptar. unziptar is not
molleweide Jan 21, 2022
d3dbaf2
add help up until update-grub-universal
molleweide Jan 25, 2022
54e51c5
Merge remote-tracking branch 'origin/master' into add-help
molleweide Jan 25, 2022
711f4b0
Merge remote-tracking branch 'origin/master' into add-help
molleweide Jan 31, 2022
a7c839c
add help fn up until `setup-util-*`
molleweide Jan 31, 2022
efddffd
add is-help template to some setup commands
molleweide Jan 31, 2022
cbf63d2
Merge remote-tracking branch 'origin/master' into add-help
molleweide Feb 3, 2022
c5ef0e8
merged
balupton Feb 4, 2022
8ea4b67
fix indentation
balupton Feb 4, 2022
63bfefe
sparse-vault: new way
balupton Feb 4, 2022
58a4633
delete `is-help*` commands to force upgrade
balupton Feb 13, 2022
cf29853
`alias-*` to `alias-helper`
balupton Feb 13, 2022
c42100b
delete `android-dev` as too niche and outdated
balupton Feb 13, 2022
d8f81c8
Remove help placeholders from commands that don’t need it.
balupton Feb 13, 2022
b9510c3
wallhaven-helper: fix bad help text
balupton Feb 13, 2022
43d6c14
delete `array-*` commands, they were from a prior convention
balupton Feb 13, 2022
710fd4a
alias-helper, ask: update help text
balupton Feb 13, 2022
514ad1e
`cert` to `openssl-helper`, still need to update code
balupton Feb 13, 2022
f05f1e2
`codec` to `get-codec`, still need code update
balupton Feb 13, 2022
817469a
`fetch-*` renames:
balupton Feb 13, 2022
bd5ddd8
`concat-files` to graveyard
balupton Feb 13, 2022
50b28b4
`ddns` to balupton/dotfiles
balupton Feb 13, 2022
a488e79
`edit-blackblaze` to graveyard
balupton Feb 13, 2022
51f50e4
`firefox-reset` to graveyard
balupton Feb 13, 2022
85d9740
`gtd` to balupton/dotfiles
balupton Feb 13, 2022
411f83b
`ios-dev` to graveyard
balupton Feb 13, 2022
0e6eb87
`padd` to balupton/dotfiles
balupton Feb 13, 2022
824905c
`travis-token` to graveyard
balupton Feb 13, 2022
e3d0342
`rand` to `get-random-number`
balupton Feb 13, 2022
27f4180
`pipp` to `pip_helper` inside `setup-util`
balupton Feb 13, 2022
29c6b37
Merge branch 'master' into add-help
balupton Feb 14, 2022
04afbde
`test “${1-}” = ‘—help’` for some internal commands
balupton Feb 14, 2022
99792ff
get-flag-value: proper help
balupton Feb 14, 2022
c3e1ba3
mail-sync: upgraded functionality
balupton Feb 14, 2022
0dc0fbc
svg-export: rewrote for modern conventions and tooling
balupton Feb 16, 2022
abaaf84
mail-sync: bugfixes around deletion and memory errors
balupton Feb 16, 2022
fb9c294
fix perms on `alias-helper`
balupton Feb 16, 2022
4f0878a
set-hostname: support for more operating systems
balupton Feb 17, 2022
01db1ab
mail-sync: better gmail to icloud handling, add help and args for cus…
balupton Feb 17, 2022
209a229
new conventions for `echo-eval`, `eval-collapse`, `setup-util`, and o…
balupton Feb 22, 2022
c86444b
until-success: new conventions, now requires `--` separator
balupton Feb 22, 2022
fc4f6b7
sudo-inherit: new conventions, requires double dash and offers help
balupton Feb 22, 2022
f30592b
debug-bash: new conventions
balupton Feb 22, 2022
ea3b613
checksum: new conventions
balupton Feb 22, 2022
3530673
debug-{docker,network}: mark as internal commands that don’t need help
balupton Feb 22, 2022
58a975d
choose-path: modern conventions, adds help
balupton Feb 22, 2022
1c09b44
date-*: modern conventions, added help text
balupton Feb 22, 2022
99002e2
`deno-cache-clean` to `rm-deno-cache` with modern conventions
balupton Feb 22, 2022
b0d9ca7
find-files: modern conventions, help
balupton Feb 22, 2022
cb0fdaa
get-codec: modern conventions, trim flag, support videos
balupton Feb 22, 2022
b1f9b06
gid, uid: modern conventions, add help
balupton Feb 22, 2022
9454e95
ensure-trailing-slash: modern conventions
balupton Feb 22, 2022
f088b53
ensure-trailing-newline: modern conventions
balupton Feb 23, 2022
3c8be4b
get-size: modern conventions
balupton Feb 23, 2022
8dd43c5
xps2pdf: modern conventions
balupton Feb 23, 2022
6055659
xps2pdf: brew can install gxps via ghostscript, use that
balupton Feb 23, 2022
dacd954
merged `fetch-*` utilities into `fetch`, gave modern conventions
balupton Feb 23, 2022
d4e72dc
tmutil-evict: modern conventions
balupton Feb 23, 2022
8210713
`ln-helper` to `symlink-helper`, `symlinks` to `find-symlinks`, apply…
balupton Feb 23, 2022
ec3801e
update some outdated help conventions
balupton Feb 23, 2022
8bc3b29
fs-temp: if XDG flag is omitted, defaults to PREFER_XDG environment v…
balupton Feb 23, 2022
c773dc2
update-grub-universal: modern conventions
balupton Feb 23, 2022
1aeb5a9
video-merge: modern conventions
balupton Feb 23, 2022
c5ee842
echo-exit-code: modern conventions
balupton Feb 23, 2022
519dc59
echo-exit-affirmative: modern conventions
balupton Feb 23, 2022
9b2b767
echo-clear-line: modern conventions
balupton Feb 23, 2022
6101838
setup-bin: modern conventions
balupton Feb 23, 2022
6643a7c
is-same: modern conventions
balupton Feb 23, 2022
b08af4d
get-drive-info: modern conventions
balupton Feb 23, 2022
a9e59b7
geocode: modern conventions
balupton Feb 23, 2022
c5babaa
contains-line: modern conventions, stdinargs redo
balupton Feb 23, 2022
ff36bf6
styles: notice now uses `yellow` over `intense_yellow`
balupton Feb 23, 2022
1a6d701
select-shell: modern conventions
balupton Feb 23, 2022
fc9f0e3
vscode: don’t enforce theme
balupton Feb 24, 2022
ee4b0ed
setup-python: fix `python-*` dir being created in CWD when not in XDG…
balupton Feb 24, 2022
7148a0c
mail-sync: icloud and gmail fixes
balupton Feb 24, 2022
aa0d8e0
fs-unmount: modern conventions
balupton Feb 24, 2022
40d3726
`what-is-my-dns*` merged into `what-is-my-dns`
balupton Feb 24, 2022
4582185
`ip-*` => `what-is-my-ip`, modern conventions
balupton Feb 24, 2022
e2be62f
what-is-my-gateway: modern conventions
balupton Feb 24, 2022
22b47c0
minor help text change
balupton Feb 24, 2022
ecbf134
what-is-my-country: modern conventions
balupton Feb 24, 2022
04d4ecb
what-is-using: modern conventions
balupton Feb 24, 2022
df18334
ytd-helper: modern conventions
balupton Feb 24, 2022
77b0dbc
modern convention revisions
balupton Feb 24, 2022
dcca845
echo-quote: modern conventions, support stdin
balupton Feb 24, 2022
817b903
echo-file: adjustments for bat depending on OS theme
balupton Feb 24, 2022
78cb3ee
setup-mac-{brew,clean}: modern conventions
balupton Feb 24, 2022
75d9223
video-merge: improvements for real world usage
balupton Feb 24, 2022
b3312fb
setup-util: improvements
balupton Feb 25, 2022
ba8e203
add `docs/` dir with convention docs and helper
balupton Feb 25, 2022
222298b
add `doroty format|test`, update conventions
balupton Feb 25, 2022
a198fbd
github: add `dorothy` workflow for CI testing
balupton Feb 25, 2022
17b75d5
dorothy: rejigged structure to solve github action
balupton Feb 25, 2022
42a2252
dorothy: github actions DOROTHY detection
balupton Feb 25, 2022
9c2eaae
dorothy: fix github action `fs-realpath` complaint
balupton Feb 25, 2022
1c5195a
github: /dev/tty workaround
balupton Feb 25, 2022
adaec73
dorothy: better realpath handling, fix custom dorothy locations being…
balupton Feb 25, 2022
6727f11
github: dump env for better debugging
balupton Feb 25, 2022
f90a919
shims: accurate compatibility, fixes bash v5.0 and v4.0 issues
balupton Feb 25, 2022
5ea0f16
github: remove macos, it fails on tty workaround
balupton Feb 25, 2022
034dab6
setup-util: fix typo from b3312fb7793346e799f71bb0b7883249d40130dc
balupton Feb 25, 2022
36f725a
setup-util-shfmt: remove DEBIAN
balupton Feb 25, 2022
e70c95d
dorothy: don't test dorothy
balupton Feb 25, 2022
a280d13
github: more debugging for ci tests
balupton Feb 25, 2022
90ea856
add `dorothy dev` mode, have ci use that
balupton Feb 25, 2022
fb6e14e
setup-util: support `...` in order preferences
balupton Feb 25, 2022
e0cb618
dorothy: test: attempt arrays instead, maybe that will fix ci issues
balupton Feb 25, 2022
98f26ad
shellcheck improvements, sort format and test files
balupton Feb 25, 2022
de904fe
`shellcheck` improvements, `inherit_errexit` recommendation
balupton Feb 25, 2022
17f5c40
dorothy: test: shellcheck only supports bourne shells
balupton Feb 25, 2022
726df24
config-helper: fix tests, echo-quote: newlines
balupton Feb 25, 2022
f78f072
sources/*.bash: use correct shebang for lint fix
balupton Feb 26, 2022
3397256
dorotohy: if dorothy exists, ensure env is loaded
balupton Feb 26, 2022
093f11f
dorothy: attempt to fix SC1091 on CI
balupton Feb 26, 2022
12d846b
add extra linting files for trunk.io
balupton Apr 9, 2022
de2170e
major rewrite of many commands, some still WIP
balupton Apr 9, 2022
8f652db
eval-helper <= echo-eval, eval-collapse, eval-confirm
balupton Apr 10, 2022
dff4955
💍 down|github-download|unziptar 🚀 eval-helper|echo-error
balupton Apr 10, 2022
354362a
🧹 setup-*
balupton Apr 10, 2022
79a992c
🐛 setup-linux-fonts
balupton Apr 10, 2022
0912d36
🚀 checksum compat 🚀 stdinargs custom arg handling
balupton Apr 10, 2022
77a978a
🐛 eval-helper
balupton Apr 10, 2022
a1c63d1
💁‍♀️ ONLY use `/dev/tty` when using `tty.bash`
balupton Apr 10, 2022
1c351e9
🐛 💣
balupton Apr 10, 2022
9416e96
🐛 setup-dns, echo-mkdir
balupton Apr 10, 2022
a62f684
🐛 `choose-menu` fix TTY
balupton Apr 10, 2022
8975eb6
🐛 `clang` => `llvm` on macOS
balupton Apr 10, 2022
77ceae2
🐛 detect corrupted `rg` and other util installs
balupton Apr 10, 2022
134fd58
🐛 setup-util: "$optional" defaults to '' not 'no'
balupton Apr 10, 2022
22e3d7a
🔨 select-shell: clearer outputs
balupton Apr 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Autoformatter friendly flake8 config (all formatting rules disabled)
[flake8]
extend-ignore = E1, E2, E3, E501, W1, W2, W3, W5
23 changes: 23 additions & 0 deletions .github/workflows/dorothy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: dorothy
"on":
- push
- pull_request
jobs:
test:
strategy:
matrix:
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout"
uses: actions/checkout@v2
- name: "Configure"
shell: 'script -q -e -c "bash {0}"'
run: |
chmod +x ./commands/*
./commands/dorothy dev
- name: "Test"
shell: 'script -q -e -c "bash {0}"'
run: |
./commands/dorothy test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# generic
**/.DS_Store
.vscode/
basic.vim

# custom to dorothy
Expand Down
2 changes: 2 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[settings]
profile=black
10 changes: 10 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Autoformatter friendly markdownlint config (all formatting rules disabled)
default: true
blank_lines: false
bullet: false
html: false
indentation: false
line_length: false
spaces: false
url: false
whitespace: false
1 change: 1 addition & 0 deletions .trunk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*out
14 changes: 14 additions & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 0.1
cli:
version: 0.8.0-beta
lint:
enabled:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
6 changes: 3 additions & 3 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"eamodio.gitlens",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"foxundermoon.shell-format",
"hedinne.popping-and-locking-vscode",
"jeff-hykin.better-shellscript-syntax",
"sidneys1.gitconfig",
"skyapps.fish-vscode",
"streetsidesoftware.code-spell-checker",
"timonwong.shellcheck"
"timonwong.shellcheck",
"Trunk.io"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
"unwantedRecommendations": ["foxundermoon.shell-format"]
}
9 changes: 4 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"[shellscript]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
"editor.defaultFormatter": "Trunk.io"
},
"[plaintext,mdx]": {
"editor.folding": false,
Expand All @@ -18,9 +18,8 @@
"editor.inlineSuggest.enabled": true,
"editor.insertSpaces": false,
"editor.renderControlCharacters": true,
"editor.renderIndentGuides": true,
"editor.renderWhitespace": "all",
"editor.tabSize": 3,
"files.trimTrailingWhitespace": true,
"workbench.colorTheme": "Popping and Locking"
"editor.tabSize": 4,
"files.trimTrailingWhitespace": true
// "workbench.colorTheme": "Popping and Locking"
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ The [`itunes-owners` command](https://github.com/bevry/dorothy/tree/master/comma

The [`ios-dev` command](https://github.com/bevry/dorothy/tree/master/commands/ios-dev) lets you easily open the iOS simulator from the terminal.

The [`alias-details`](https://github.com/bevry/dorothy/tree/master/commands/alias-details), [`aliases`](https://github.com/bevry/dorothy/tree/master/commands/aliases), [`aliases-to-symlink`](https://github.com/bevry/dorothy/tree/master/commands/aliases-to-symlink), [`alias-path`](https://github.com/bevry/dorothy/tree/master/commands/alias-path), [`alias-verify`](https://github.com/bevry/dorothy/tree/master/commands/alias-details) commands will help you convert MacOS aliases into symlinks.
The [`alias-helper`](https://github.com/bevry/dorothy/tree/master/commands/alias-helper) will help you manage your macOS aliases, and if desired, convert them into symlinks.

### Media

Expand Down
42 changes: 0 additions & 42 deletions commands/alias-details

This file was deleted.

217 changes: 217 additions & 0 deletions commands/alias-helper
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
#!/usr/bin/env bash
source "$DOROTHY/sources/strict.bash"

function alias-helper() (
# =====================================
# Arguments

function help {
cat <<-EOF >/dev/stderr
ABOUT:
Wrappers around macOS aliases to make things easier.

USAGE:
alias-helper <action>

ACTIONS:
new -- <alias-file-path> <target-file-path>
Makes a new macOS alias file at the <alias-file-path> pointing to the <target-file-path>.

symlink -- <alias-file-path>
Converts the macOS alias file with its UNIX symlink equivalent.

verify -- <alias-file-path>
Verify the path is a macOS alias file.

target -- <alias-file-path>
Output the target if the path is a macOS alias file.

info -- <alias-file-path>
Human friendly details about the macOS alias file.
EOF
if test "$#" -ne 0; then
echo-error "$@"
fi
return 22 # Invalid argument
}

# process
local item action='' args=()
while test "$#" -ne 0; do
item="$1"
shift
case "$item" in
'--help' | '-h') help ;;
'--')
args+=("$@")
shift $#
break
;;
'--'*) help "An unrecognised flag was provided: $item" ;;
*)
if test -z "$action"; then
action="$item"
else
help "An unrecognised argument was provided: $item"
fi
;;
esac
done

# =====================================
# Actions

function alias_verify {
local path="$1"
silent-stderr osascript <<-EOF
tell application "Finder"
set theItem to (POSIX file "$path") as alias
if the kind of theItem is "alias" then
get the posix path of ((theItem) as text)
end if
end tell
EOF
}

function alias_target {
local path="$1"
silent-stderr osascript <<-EOF
tell application "Finder"
set theItem to (POSIX file "$path") as alias
if the kind of theItem is "alias" then
get the POSIX path of ((original item of theItem) as text)
end if
end tell
EOF
}

function alias_info {
local path="$1" src target

# verify
src="$(alias_verify "$path" || :)"
if test -z "$src"; then
{
echo-style \
--bold+red="$path" \
$'\t' \
$'\t' --error='← not an alias'
return 22 # EINVAL Invalid argument
} >/dev/stderr
fi

# target
target="$(aliastarget "$path" || :)"
if test -z "$target"; then
{
stderr echo-style \
--bold="$src" \
$'\t' \
$'\t' --error='← target broken'
return 9 # EBADF Bad file descriptor
} >/dev/stderr
fi
if test ! -e "$target"; then
{
stderr echo-style \
--bold="$src" \
--nocolor=$'\t' --color+dim=$'\t→\t' --bold+red="$target" \
$'\t' --error='← target missing'
return 2 # ENOENT No such file or directory
} >/dev/stderr
fi

# success
echo-style \
--bold="$src" \
--nocolor=$'\t' --color+dim=$'\t→\t' --bold+green="$target"
}

function alias_new {
local path="$1" target="$2" type target_absolute path_absolute path_directory path_filename
target_absolute="$(fs-absolute "$target")"
path_absolute="$(fs-absolute "$path")"
path_directory="$(dirname "$path_absolute")"
path_filename="$(basename "$path_absolute")"

# act
if test -d "$target_absolute"; then
type="folder"
elif test -f "$target_absolute"; then
type="file"
else
{
echo-style --error='Invalid path or unsupported type:' ' ' --code="$path"
return 22 # EINVAL Invalid argument
} >/dev/stderr
fi

if test -f "$path_absolute"; then
fs-rm "$path_absolute"
fi

osascript <<-EOF
tell application "Finder"
make new alias to ${type} (posix file "$target_absolute") at (posix file "$path_directory")
set name of result to "$path_filename"
end tell
EOF

# make the alias's permissions the same as the target's
chmod "$(stat -f '%p' "$target_absolute")" "$path_absolute"
#chmod --reference="$targetPath" "$path_absolute"
}

function alias_symlink {
local path="$1" src target

# verify alias
src="$(alias_verify "$path" || :)"
if test -z "$src"; then
{
echo-style --bold+red="$path" ' ' --error='<- not an alias'
return 22 # EINVAL Invalid argument
} >/dev/stderr
fi

# verify target
target="$(alias_target "$path" || :)"
if test -z "$target"; then
{
echo-style --bold="$src" --dim=' → ' --bold+red="$target" ' ' --error='← target broken'
return 9 # EBADF Bad file descriptor
} >/dev/stderr
fi
if test ! -e "$target"; then
{
echo-style --bold="$src" --dim=' → ' --bold+red="$target" ' ' --error='← target missing'
return 2 # ENOENT No such file or directory
} >/dev/stderr
fi

# convert
if test -f "$target"; then
ln -nfs "$target" "$src"
echo "converted $path -> $target"
elif test -d "$target"; then
ln -nfs "$target" "$src"
echo "converted $path -> $target"
fi
}

# =====================================
# Act

if test "$(type -t "alias_$action")" = 'function'; then
"alias_$action" "${args[@]}"
return "$?"
else
echo-style --error="Action [$action] not yet implemented." >/dev/stderr
return 78 # Function not implemented
fi
)

# fire if invoked standalone
if test "$0" = "${BASH_SOURCE[0]}"; then
alias-helper "$@"
fi
Loading
Loading