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

improve installation experience #281

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3737476
setup-util-bash: cross-os compat building
balupton Feb 4, 2025
990caa3
ask: fix incompatibility with bash v3 due to it not support `read -i`
balupton Feb 5, 2025
3bb7c66
vscode: note other useful extensions in comment
balupton Feb 8, 2025
ca9d37b
echo-count-lines: lint help text
balupton Feb 8, 2025
0f4dfcb
fetch: fix broken `wget` implementation, have `wget` output errors sa…
balupton Feb 8, 2025
2ccb1a3
get-terminal-theme: note conditions that can cause a failure
balupton Feb 8, 2025
912720f
macos-state: fix a non-functional bug since 2022, perhaps longer
balupton Feb 8, 2025
8cc8010
macos-theme: use `--` path prefix with the `echo-wait` call
balupton Feb 8, 2025
6b79b17
styles: note the capabilities of Ghostty
balupton Feb 8, 2025
eb7cc34
docs/replace-inline: use `--` path prefix with the `echo-wait` call, …
balupton Feb 8, 2025
51ec354
dorothy: add `--skip-deps` to disable dependency checks when user alr…
balupton Feb 8, 2025
a1f03fc
command-working: add `gsed`/`sed` to exceptions
balupton Feb 8, 2025
1b4bf1d
ssh-helper: allow `--configure` to be used with actions correctly, in…
balupton Feb 8, 2025
c158b97
remove unnecessary `__require_array 'mapfile'`
balupton Feb 8, 2025
75797d5
choose: debug when receiving invalid items
balupton Feb 8, 2025
73b7da4
readme: clearer messaging around `bash -i` workaround on unsupported …
balupton Feb 9, 2025
969484d
redo `dorothy install` user configurations setup
balupton Feb 9, 2025
ef75619
styles: also clear on default buffer, necessary for vscode
balupton Feb 9, 2025
754b294
setup-mac-brew: linting
balupton Feb 9, 2025
301c48c
bash: linting, also fix `arg` leaking to global in `__has_array_capab…
balupton Feb 9, 2025
13d7fad
dorothy: fix `README.md` bouncing between different formatting
balupton Feb 9, 2025
ac8d0da
Merge branch 'master' into dev/devilbird
balupton Feb 9, 2025
d3cacc2
dorothy: fix bad refactor in 969484d87ddab7dffc5b6eb34eea96a48fd7c051
balupton Feb 9, 2025
5430d8b
ci: fix the underlying failure with xonsh var failures
balupton Feb 9, 2025
de652a4
get-installer: fix tests
balupton Feb 9, 2025
3842e0f
improve `eval_capture` and test on all bash versions
balupton Feb 10, 2025
65912de
use `--` path prefix on `touch`
balupton Feb 10, 2025
7d52172
config-helper: linting
balupton Feb 10, 2025
2c75e80
get-installer: bash v3 compat
balupton Feb 10, 2025
d3a6ca9
dorothy-config: test: track config updates for debugging
balupton Feb 10, 2025
91e1f66
change all `echo`s where appropriate with `printf`
balupton Feb 11, 2025
331cca2
`eval_capture`: solve failing tests on linux
balupton Feb 12, 2025
c466143
dorothy-config: fix bad source line output
balupton Feb 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .github/workflows/dorothy-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ jobs:
setup-util-ksh
setup-util-carapace
dorothy --slug=${{ github.event.pull_request.head.repo.full_name || github.repository }} install
# nu -c 'echo $nu.loginshell-path'
- name: 'Dorothy Login Shell: bash'
shell: bash -leo pipefail {0}
run: |
Expand All @@ -109,13 +108,7 @@ jobs:
command-exists -- dorothy
echo-style --success='ok'
- name: 'Dorothy Login Shell: xonsh'
env:
PKG_CONFIG_PATH: '' # fix: https://github.com/bevry/dorothy/actions/runs/6349881708/job/17248752072#step:8:8
LDFLAGS: '' # fix: https://github.com/bevry/dorothy/actions/runs/6349927188/job/17248892389#step:8:9
CPPFLAGS: '' # fix: https://github.com/bevry/dorothy/actions/runs/6349956372/job/17248986621#step:8:10
CXX: '' # fix: https://github.com/bevry/dorothy/actions/runs/7538723888/job/20519802798#step:8:12
CC: '' #fix: https://github.com/bevry/dorothy/actions/runs/7538922544/job/20520381661#step:8:13
shell: xonsh -DXONSH_SHOW_TRACEBACK=True -l {0}
shell: xonsh -DXONSH_SHOW_TRACEBACK=True -DXONSH_TRACEBACK_LOGFILE=xonsh.log -l {0}
run: |
command-exists -- dorothy
echo-style --success='ok'
Expand Down Expand Up @@ -146,7 +139,7 @@ jobs:
# commit changes, if any
cd "$DOROTHY"
if git diff --quiet &>/dev/null; then
echo 'Already formatted.'
printf '%s\n' 'Already formatted.'
else
git config --global user.name 'Continuous Integration'
git config --global user.email '[email protected]'
Expand Down
3 changes: 3 additions & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@ lint:
- linters: [trufflehog]
paths:
- commands/setup-util-warp
- linters: [checkov]
paths:
- config/installers.json
4 changes: 4 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"trunk.io"
],

// List of extensions not needed but you will probably find useful:
// MS-vsliveshare.vsliveshare
// ms-vscode-remote.vscode-remote-extensionpack

// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [
"timonwong.shellcheck",
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ If the automated installation of any failed, [post an issue](https://github.com/
To run a specific command in/from the Dorothy environment, enter the following, swapping out everything after the double-dash (`--`) with whatever command to run:

```bash
bash -i # in case your shell doesn't recognize the next command
bash -ic "$(curl -fsSL https://dorothy.bevry.me/run)" -- dorothy commands
# if your shell doesn't recognize any of the above syntax, run `bash -i` then try again
```

To run multiple commands in/from a Dorothy-configured REPL, enter the following line by line:

```bash
bash -i # in case your shell doesn't recognize the next command
bash -ic "$(curl -fsSL https://dorothy.bevry.me/repl)"
# if your shell doesn't recognize any of the above syntax, run `bash -i` then try again

# now you can run whatever and how many commands as you'd like, such as:
dorothy commands
Expand All @@ -198,8 +198,8 @@ exit
> To install Dorothy enter the following into your favorite terminal application:

```bash
bash -i # in case your shell doesn't recognize the next command
bash -ic "$(curl -fsSL https://dorothy.bevry.me/install)"
# if your shell doesn't recognize any of the above syntax, run `bash -i` then try again
```

During installation, Dorothy will ask you to create a repository to store your user configuration, such as a `dotfiles` repository. If you already have a dotfiles repository, you can use that, or make another.
Expand Down
4 changes: 4 additions & 0 deletions commands.beta/echo-eval
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env bash

# [Stack Exchange: How to apply shell command to each line of a command output?](https://stackoverflow.com/a/68310927/130638)
# `ls -1 | xargs -I %s -- echo %s`
# ^ xargs is too complicated, hence why this now exists

function echo_eval() (
source "$DOROTHY/sources/stdinargs.bash"

Expand Down
2 changes: 1 addition & 1 deletion commands.beta/echo-nonflags
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function echo_nonflags() (

[edit --dry | echo-nonflags --stdin] will output [code -w -n] because of the following:

echo 'code -a --b c' | echo-nonflags --stdin
printf '%s\n' 'code -a --b c' | echo-nonflags --stdin

code -a --b c
# exit status: 0
Expand Down
2 changes: 1 addition & 1 deletion commands.beta/echo-nothing-or-fail
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function echo_nothing_or_fail() (
echo-nothing-or-fail ''
echo-nothing-or-fail -- ''
echo-nothing-or-fail -- 'sup'
echo 'sup' | echo-nothing-or-fail --stdin
printf '%s\n' 'sup' | echo-nothing-or-fail --stdin

# exit status: 1

Expand Down
6 changes: 3 additions & 3 deletions commands.beta/eval-on-empty-stdin
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ function eval_on_empty_stdin() (
# Action

# test cases:
# echo sup | ( eval-on-empty-stdin echo no )
# true | ( eval-on-empty-stdin echo no )
# true | ( eval-on-empty-stdin cat )
# printf '%s\n' sup | ( eval-on-empty-stdin -- printf '%s\n' no )
# true | ( eval-on-empty-stdin -- printf '%s\n' no )
# true | ( eval-on-empty-stdin -- cat )

# doesn't work: read -r
# doesn't work: [[ -t 0 ]]
Expand Down
4 changes: 2 additions & 2 deletions commands.beta/eval-on-not-empty-stdin
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ function eval_on_not_empty_stdin() (
# Action

# test cases:
# echo-lines -- 1 2 | ( eval-on-not-empty-stdin cat )
# true | ( eval-on-not-empty-stdin echo sup )
# echo-lines -- 1 2 | ( eval-on-not-empty-stdin -- cat )
# true | ( eval-on-not-empty-stdin -- printf '%s\n' sup )

# doesn't work: grep --regexp='^' | "${option_cmd[@]}" # eval

Expand Down
1 change: 0 additions & 1 deletion commands.beta/macos-settings
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

function macos_settings() (
source "$DOROTHY/sources/bash.bash"
__require_array 'mapfile'

# =====================================
# Arguments
Expand Down
2 changes: 1 addition & 1 deletion commands.beta/macos-state
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function macos_state() (
}

function process {
local title="$1" paths=("${@:1}") path=''
local title="$1" paths=("${@:2}") path=''
echo-style --h1 "$title"
if confirm --linger --bool --ppid=$$ -- "Do you want to $action $title"; then
for path in "${paths[@]}"; do
Expand Down
2 changes: 1 addition & 1 deletion commands.beta/macos-theme
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function macos_theme() (
local vscode_theme="$1"
# @todo style with var_dump or something
echo-style --bold="Visual Studio Code Theme: " "$vscode_theme"
jq ".[\"workbench.colorTheme\"] = \"$vscode_theme\"" "$VSCODE_SETTINGS_FILE" | echo-wait "$VSCODE_SETTINGS_FILE"
jq ".[\"workbench.colorTheme\"] = \"$vscode_theme\"" "$VSCODE_SETTINGS_FILE" | echo-wait -- "$VSCODE_SETTINGS_FILE"
}
function macos_dark_mode_enable {
local dark_mode="$1"
Expand Down
1 change: 0 additions & 1 deletion commands.beta/researchgate-rename
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ function researchgate_rename() (
f="$(mktemp)"
pdftotext -layout -eol unix "$file" "$f"
while read -r line; do
# echo $line
if [[ -z $id ]]; then
# find id
id="$(__print_lines "$line" | echo-regexp -on "$regex" '$1')"
Expand Down
1 change: 0 additions & 1 deletion commands.beta/wallhaven-helper
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

function wallhaven_helper() (
source "$DOROTHY/sources/bash.bash"
__require_array 'mapfile'

# =====================================
# Arguments
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/usr/bin/env bash

# https://packages.debian.org/sid/amd64/openssh-server/filelist
# /usr/sbin/sshd

function setup_util_sshd() (
source "$DOROTHY/sources/bash.bash"
dorothy-warnings add --code='setup-util-sshd' --bold=' has been deprecated in favor of ' --code='setup-util-ssh'

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

# setup
local options=(
Expand Down
4 changes: 2 additions & 2 deletions commands/ask
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ function ask_() (
local terminal_device_file terminal_reactive inline
terminal_device_file="$(get-terminal-device-file)"
terminal_reactive="$(get-terminal-reactivity-support)"
if [[ $terminal_reactive == 'no' || $option_inline == 'no' ]]; then
if [[ $terminal_reactive == 'no' || $option_inline == 'no' || $BASH_CAN_READ_I == 'yes' ]]; then
inline='no'
else
inline='yes'
Expand Down Expand Up @@ -396,7 +396,7 @@ function ask_() (
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 expectations, e.g.
# echo 'overwrite' | { ask --linger --default='d1' --skip-default --question='q1'; ask --linger --default='d2' --skip-default --question='q2' )
# __print_lines '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 [[ $option_confirm_default == 'no' ]] && is-value -- "$RESULT"; then
return 0
Expand Down
1 change: 0 additions & 1 deletion commands/brew
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ function brew_() (
else
echo-style --error1='Homebrew is not installed.'
fi
# ^ don't use get-installer, as bash v5 may not exist yet
return 74 # EPROGUNAVAIL 74 RPC prog. not avail
fi
return 22 # EINVAL 22 Invalid argument
Expand Down
1 change: 0 additions & 1 deletion commands/checksum
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

function checksum_() (
source "$DOROTHY/sources/bash.bash"
__require_array 'mapfile'

local item algorithms=()
for item in 'md5sum' 'shasum' 'sha256sum'; do
Expand Down
4 changes: 2 additions & 2 deletions commands/choose
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,6 @@ function choose_test() (
)
function choose_() (
source "$DOROTHY/sources/bash.bash"
__require_array 'mapfile'

# =====================================
# Arguments
Expand Down Expand Up @@ -716,6 +715,7 @@ function choose_() (
}

# process
local args_string="$*"
local item='' inputs=() tmp=()
local option_question=()
local option_label='no' option_visual='' option_return='$VALUE' option_matches=()
Expand Down Expand Up @@ -798,7 +798,7 @@ function choose_() (

# ensure items were provided
if [[ ${#inputs[@]} -eq 0 ]]; then
help 'No <item>s provided.'
help "choose: no <item>s provided: $0 $args_string"
fi
if [[ ${#option_matches[@]} -eq 0 ]]; then
option_matches=('$VALUE')
Expand Down
1 change: 0 additions & 1 deletion commands/choose-path
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

function choose_path() (
source "$DOROTHY/sources/bash.bash"
__require_array 'mapfile'

# =====================================
# Arguments
Expand Down
3 changes: 3 additions & 0 deletions commands/command-working
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ function command_working() (
# https://trunkcommunity.slack.com/archives/C0205B6KK8X/p1661601215325159
local failures=() exceptions=(
dash
gsed
ksh
rmtrash
rpi-update
sed
ssh
ssh-askpass
sshd
teip
Expand Down
12 changes: 6 additions & 6 deletions commands/config-helper
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ function config_helper_test() (
fi

# prepare
fs-rm --quiet --no-confirm -- "$(fs-temp --directory='config-helper')"
local test_file missing_file expected_stderr
local root test_file missing_file expected_stderr
root="$(fs-temp --directory='config-helper')"
fs-rm --quiet --no-confirm -- "$root"
test_file="$(
fs-temp \
--directory='config-helper' \
--root="$root" \
--directory='tests' \
--file --touch
)"
missing_file="$(
fs-temp \
--directory='config-helper' \
--root="$root" \
--directory='tests' \
--file --no-touch
)"
Expand Down Expand Up @@ -146,7 +147,6 @@ function config_helper_test() (
)
function config_helper() (
source "$DOROTHY/sources/bash.bash"
__require_array 'mapfile'

# =====================================
# Arguments
Expand Down Expand Up @@ -223,7 +223,7 @@ function config_helper() (

# ensure file exists
if [[ ! -f $option_file ]]; then
touch "$option_file"
touch -- "$option_file"
fi

# =====================================
Expand Down
16 changes: 11 additions & 5 deletions commands/cpr
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# https://github.com/schollz/croc - 28.6k stars, maintained, last update 2 weeks ago
# https://github.com/magic-wormhole/magic-wormhole - 20.8k stars, maintained, last update 3 days ago
#
# https://github.com/ShareDropio/sharedrop - 10.4k stars, maintained, last update 2 months ago
# https://github.com/kern/filepizza - 4.5k stars, maintained, last update 3 days ago
# https://github.com/ShareDropio/sharedrop - 10.4k stars, maintained, last update 2 months ago - is a web app
# https://github.com/kern/filepizza - 4.5k stars, maintained, last update 3 days ago - is a web app
#
# https://github.com/SpatiumPortae/portal - 1.6k stars, last update 8 months ago
# https://github.com/nils-werner/zget - 484 stars, last update 7 months ago
Expand All @@ -22,6 +22,12 @@
# https://github.com/devclub-iitd/SenData - 16 stars, last update 5 years ago
# https://github.com/rockymadden/github-crypt - 15 stars, last update 7 years ago

# drop support for these:
# gcp - last update 2019
# https://github.com/aelafifi/gcp
# https://code.lm7.fr/mcy/gcp
# https://repology.org/project/gcp/packages

function cpr_() (
source "$DOROTHY/sources/bash.bash"

Expand All @@ -34,19 +40,19 @@ function cpr_() (
copy_tools+=(rsync)
fi
if __command_exists -- gcp; then
# setup-util-gcp
# @todo drop, as it is outdated
copy_tools+=(gcp)
fi
if __command_exists -- scp; then
# setup-util-scp
# bundled wih openssh-client
copy_tools+=(scp)
fi
if __command_exists -- cp; then
# setup-util-coreutils
copy_tools+=(cp)
fi
if __command_exists -- diff; then
# setup-util-git
# setup-util-diff
verify_tools+=(diff)
fi
if __command_exists -- git; then
Expand Down
Loading