-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
test
to [[
where available
#261
Conversation
fixes: - init.sh: fix a missing `-d` - github-download: fix a missing `-n` - mount-helper: fix a missing `-n` - setup-git: fix a missing `test`/`[[` - waiter: fix missing `-n` todos: - note this change of convention in the docs - see if there is an alternative for the sudo calls - review the PR to check if there were any errors
- add `is-(directory|file|missing|not-directory|present|readable)(.bash)?` - is-missing: fix incorrect help text on exit status
- mount-helper: fix missing `-n`, however seems better to just always fetch a single line here - debug-network: fix WIP commit using `[[` in a sh script, instead of `[`
- `while true` to `while :`, and `true` to `:` where appropriate - brew: compact a conditional - (choose|config-helper|confirm|echo-lines|is-empty-value|setup-(git|linux|mac|system)): compact an or conditional - is-suffix: update for `__substr` shim in `bash.bash` for bash v3 support - `is-dir`: move to deprecated, as there is now `is-directory`
todos: - choose: needs truncating of choose body, if too long, possible with `fs-rm` and `fs-trim` with large directory content listing: `eza -lA | sed -e '5,$d' -e '4,$s/.*/Truncated./'` is suitable, however our own command would work - eval-helper: check if pending/success/failure messages are still going to TTY - is-not-symlink: update copy and pasted tests to match its functionality - consider renames of `echo-exit-affirmative`, `echo-exit-status`, `is-root` changes: - choose: - optional will now cancel to nothing, only required cancels to defaults - can now press R to revert to defaults - dorothy: - permissions action no longer trims junk files, as they are already git-ignored - `fs-realpath`, `fs-structure`, `fs-trim`, `is-broken-symlink`, `is-directory`, `is-empty-directory`, `is-empty-file`, `is-file`, `is-missing`, `is-not-directory`, `is-not-symlink`, `is-present`, `is-readable`, `is-symlink`, `is-nonempty-file`: - support `--(sudo|user|group)` arguments - consistent internal structure - add tests where appropriate - `fs-rm`, `fs-trim`, `fs-structure`: - rewrote `fs-rm` for new `fs-trim` command, with exact prompts on what to do, no longer overly complex and fragile - rewrote `fs-structure` to prefer `exa`, comment out verbose `dust`/`du` handling as `exa` is better and more understandable for this use case, made perms and time toggles - fs-temp: - clarified touch functionality (will make directories, but not files, by default), make `--no-touch` not make directories - add `fs-trim`: - consolidated functionality from: `fs-rm`, `rm-junk`, `rm-modules` - clear handling of symlinks - add `is-broken-symlink`, `is-empty-directory`, `is-empty-file`, `is-not-symlink`, `is-file`, `is-not-symlink`, `is-symlink`: - is-generic: - change return status behaviour on multiple arguments to be consistent with others - promoted `is-even` from beta commands - add `setup-util-qpdf` for `pdf-decrypt`, and updated `pdf-decrypt` for modern covnentions - sudo-helper: - add `--[no-]sudo` flag, which if no and no user nor group, then no sudo is needed fixes: - choose: pressing escape/q to cancel now works again - echo-values: fix help text being incorrect - eval-helper: wrapping will now have wraps go to stdout - get-terminal-theme: more accurate parsing of `COLORFGBG` - is-admin: fix multiple users handling - setup-dns: improve handling of bad interfaces fetch renames and deprecations: - `is-nonempty-string` to `is-not-whitespace` - `is-empty-string` to `is-whitespace` - `is-empty-ls` to `is-empty-directory`, turns out we had two commands doing the same thing - `is-dir` to `is-directory` - `is-either` to `is-needle`, `is-neither` to `! is-needle` - `echo-if-empty` to `echo-with-whitespace-fallback`, added `echo-with-empty-fallback` for zero-length - `echo-values` promoted from beta, used within `setup-dns` - `fs-size` deprecated as it was the same as `fs-structure`; use `fs-structure` or `get-size` instead - `rm-vmware` to `rm-vmware-fusion` - `rm-junk` and `rm-modules` to `fs-trim --junk` - deprecate `is-array-*` and `get-array-*` commands - deprecate `is-exec`, `is-equal`, `rm-svn`, and `rm-sync` until there is a use case for them linting: - down: as `fs-temp` touch usage is now clarified, improve logic around mkdirp call - fs-filename: use the new options help text format - get-terminal-color-support: fix return status help text - remove unnecessary `--status=0` in `eval-tester` calls - improve wording of return statuses in help text - improve wording around whether symlinks are considered or not in various commands - added `Companion to ...` line to improve discovery of (related) commands and their functionality
2538a59
to
ccda6c8
Compare
- 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
9f7e1e8
to
808f55c
Compare
808f55c
to
b96a30f
Compare
5cc1ae7
to
839a82c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 559 out of 576 changed files in this pull request and generated no suggestions.
Files not reviewed (17)
- .vscode/workspace.code-workspace: Language not supported
- commands.beta/convert-helper: Language not supported
- commands.beta/echo-affirmative: Language not supported
- commands.beta/echo-escape-special: Language not supported
- commands.beta/echo-exit-affirmative: Language not supported
- commands.beta/echo-exit-status: Language not supported
- commands.beta/echo-html-coder.recode: Language not supported
- commands.beta/echo-html-coder.textutil: Language not supported
- commands.beta/echo-html-coder.xmlstarlet: Language not supported
- commands.beta/echo-if-directory: Language not supported
- commands.beta/echo-if-executable: Language not supported
- commands.beta/echo-if-path: Language not supported
- commands.beta/echo-last-line: Language not supported
- commands.beta/echo-mkdir: Language not supported
- commands.beta/echo-non-affirmative: Language not supported
- commands.beta/echo-nonflags: Language not supported
- commands.beta/echo-nothing-or-fail: Language not supported
- add `echo-if-directory`, `echo-if-executable`, `echo-if-present`, `is-executable`, `is-writable` - `echo-if-file`, `fs-dequarantine` now consistent with other such helpers - fs-trim: fix bad filename code handling, use new `is-needle` flags - is-needle: add `--ignore-case`, `--all`, `--any` flags, and enforce expected arg usage - setup-dns: simplify `fs-rm` call as the extra stuff is no longer necessary - setup-util-bash: simplify `is-needle` call - echo-truncate-lines: move to beta, as no active users - setup-server: use fs helpers wherever appropriate - deprecate `echo-if-path` for `echo-if-present`
2e4f695
to
72339a7
Compare
dffa6fc
to
dcb21f4
Compare
dcb21f4
to
13c335f
Compare
…or commands, so that `dorothy todos` can detect usage correctly
…` is now intelligent enough to handle escalation itself if needed
…emoving manual CLI paths
``` > nvm-env -- npm ++ '[' -z /Users/balupton/.nvm ']' ++ '[' -s /Users/balupton/.nvm/nvm.sh ']' ++ . /Users/balupton/.nvm/nvm.sh +++ NVM_SCRIPT_SOURCE=']' +++ '[' -z '' ']' +++ export NVM_CD_FLAGS= +++ NVM_CD_FLAGS= +++ nvm_is_zsh +++ '[' -n '' ']' +++ '[' -z /Users/balupton/.nvm ']' +++ case $NVM_DIR in +++ unset NVM_SCRIPT_SOURCE +++ nvm_process_parameters +++ local NVM_AUTO_MODE +++ NVM_AUTO_MODE=use +++ '[' 0 -ne 0 ']' +++ nvm_auto use +++ local NVM_MODE +++ NVM_MODE=use +++ case "${NVM_MODE}" in +++ local VERSION +++ local NVM_CURRENT ++++ nvm_ls_current ++++ local NVM_LS_CURRENT_NODE_PATH +++++ command which node ++++ NVM_LS_CURRENT_NODE_PATH= ++++ nvm_echo none ++++ command printf '%s\n' none +++ NVM_CURRENT=none +++ '[' _none = _none ']' ++++ nvm_resolve_local_alias default ++++ nvm_echo ++++ command printf '%s\n' '' +++ VERSION=N/A +++ '[' -n N/A ']' +++ '[' _N/A '!=' _N/A ']' +++ return 0 + npm env: node: No such file or directory ```
regression introduced from what appears to be a refactoring glitch in: - c4d1e1f - #254 - https://github.com/bevry/dorothy/blame/4f66b71111d819564db8e0e4130db88b8ac836dd/commands/ask - d605711#diff-472c231c97417631c7aed9672b65bbc7dc3c33ff032ee7324b7bb3bf97ce3a5cL345-L346 probably closes #265
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testing.
conventions.md seemed to show as draft PR even though we had finished the PR.
these conventions need to be updated before merge: |
/close #265 #268
Using
[[ ... ]]
instead oftest
is a convention change that improves performance and resolves edge cases wheretest -n "$a" -a "$b" = "$c"
fails whena='>'
.This PR also features these highlights:
ask
: fixed clearing issue /close Bug:ask
prompt is not clearing correctly, causing ask prompt and answer to duplicate and cursor to move in-between data #265is-*
filesystem commands for filesystem interactions which use a newis-accessible
command to determine if a sudo escalation is needed, benefiting Improvement: smooth installation on non-root systems #233 and closes Suggestion: instead of requiringsudo
foris-present
andis-missing
failures, test if assumptions are correct #268, full list of commands:is-accessible
is-broken-symlink
is-directory
is-empty-directory
is-empty-file
is-executable
is-file
is-missing
is-nonempty-file
is-not-directory
is-not-symlink
is-owner
is-present
is-readable
is-symlink
is-writable
echo-if-directory
echo-if-executable
echo-if-file
echo-if-present
fs-absolute
fs-own
fs-dequarantine
fs-parents
fs-realpath
fs-structure
gocryptfs-helper
secret
fs-rm
: completely rewritten for a superior experience, with revised functionality to simplify and secure its human and programmatic usage (such as insetup-dns
), also supports--trash
fs-structure
: rewritten, and now used infs-own
,fs-rm
,fs-trim
,gocryptfs-helper
,is-same
,setup-util
,eject-all
fs-trim
to assist withfs-rm
under certain circumstanceschoose
:--truncate-body
for when we allow the question's body/description/details to be truncated to make way for items, used byfs-rm
andfs-trim
, defaults to disabled--default-all
for defaulting to selection of everything, defaults to disabled--confirm-cancel
which now defaults to enabledstyles.bash
values for terminal title and resize modificationsr
key for reversion, along with the priorz
keydorothy
:dnf
ecosystem changes breaking installation on dnf setupsinstall
action: cleaner removal.profile
modification if nobash
,dash
,ksh
lint
andtest
actions now sort files by most recent first, andtest
action will call the newgit-helper umt
command and action on CI to ensure clone dates are correctcommands
action: lists all the available commands, recommended now in post-install instructions, uses newecho-if-present
command, however doesn't yet usefs-structure
todos
action: support checking core and beta commands, correct detection of usage, correct error status reporting, clearer indication when help text is missing, fix missing and incorrect local varsis-ci
instead of an archaic techniquepermissions
action: no longer trim junk files, as they are already git-ignoredsources/tests.bash
for assisting the fs commands with their testsis-owner
command for detecting if a user or group has ownership of a pathis-root
command for detecting if a user is a root user (maybe one day this should support the root group as well)read-key
: added a--continue
option for debugging, but most importantly reduced the subsequent timeout from0.0001
to0.01
to prevent situations where a key was read only partially and caused incorrect keys to be assumed, causing sayask
,choose
,confirm
to interpret an escape key that wasn't actually pressedsetup-util
:styles.bash
instead of callingecho-style
for performancefs-rm
flow for removing leftover and conflicting pathsrm_helper_confirm
torm_helper_which
to better explain its purposeecho_fallback
tolog_fallback
APT_REPO
http
vshttps
warningfs-structure
for outputting when a download build glob fails$(... something that calls setup-util ...)`` does not get a bunch of install junk in the result, as was the case for
tests.bashcalling of
symlink-helper` which installed coreutils for realpathoutputpipe="$terminal_device_file"
to whenuse_alt_screen_buffer
wasno
sudo-helper
: add alternative values for--sudo
option, to enable optional escalation under various circumstances, and simplified logicsymlink-helper
: support--target=
as alias for--existing=
, and improve--quiet
and--verbose
handling to ensure outputs match expectations, and with nothing going to stdoutOther changes to the core:
--status=0
option witheval-tester
=~ ^(...|...)$
instead of multiple== ... ||
statements for easier human parsinginit.sh
: fix a missing-d
config-edit
:--editer
changed to correct spelling of--editor
command-working
: addrmtrash
to the exceptiondown
:--progress
option that is enabled by default, except on CI where it is disabled by default which prevents progress bars from appearing on CIedit
: don't outputNone of the configured editors were available
if there are no configured editors, such as the case on a new machine (review this later, as we may still want a warning, but a better warning on more specific certain situations)echo-style
: fixed empty--=
and--
usage, the implementation seemed broken from the starteval-helper
:sudo-helper
automatically as a shapeshifter, as it is impossible to know how many lines it used while attempting passwords, so impossible to clear it accurately in non-shapeshifter modeecho-revolving-door
don't output anything to stdout, as anything would not be correct as it would be truncatedflush-dns
: use--shapeshifter
on thesudo-helper
calls for interacting with dns responders to ensure it is all rendered correctlyfs-dequarantine
: use/usr/bin/xattr
as homebrew can cause conflicts withxattr
fs-filename
: fix help conventionfs-own
:--recursive
with variant spelling--root
for setting ownership as the platform's root user and group--verbose
on macosfs-temp
: clarified--touch
behaviour, and support--no-touch
on directoriesget-flag-value
: implement--fallback-on-empty
option used byfs-absolute
get-json-api-url.awk
: fix typo in var nameget-profile
: correct spelling ofpossesive-pronoun
topossessive-pronoun
get-terminal-color-support
: clarified help text on return statuses in different modesget-terminal-theme
: useis-integer
sanity check forcolorfgbg
sourcegit-helper
: add newumt
action to apply commit modification times to cloned git repos, used bydorothy test
on CIgithub-download
: fix a missing-n
on$pathname
exclusivity checkis-empty-value
: added tests and made performantis-admin
: fix multiple user handlingis-even
: add tests, and only support integersis-generic
: added empty string as generic, added more testsis-missing
: fix incorrect help text on exit statusis-needle
: added more tests, added--all
and--any
option modifiersis-odd
: add tests, and only support integersmount-helper
: fix two missing-n
if test -n "$option_username" -o "$option_password"; then
would have caused an error state if only password is definedif test -n "$temp" -a "$option_label"; then
changed to justif [[ -n $temp ]]; then
as in this case, it seems better to not exist, as we always want the first line of$temp
regardless of$option_label
(however, then it is more a sanity procedure, but a necessary one)researchgate-rename
: fix badis-same
callsetup-dns
: use newfs-rm
flow for removing unwanted configuration and installation files, and fix potential regression issue when removals were already removedsetup-git
: fix a missingtest
/[[
if test "$GPG_SIGNING_AGENT" != 'op' && "$GPG_SIGNING_AGENT" != 'krypton'; then
affectedGPG_SIGNING_AGENT
when not using 1passwordsetup-mac-brew
: don't enforce sudo for the cleanupfs-rm
, asfs-rm
is now intelligent enough to handle escalation itself if neededsetup-util-asciinema
setup-util-eza
: usehttps
forAPT_REPO
setup-util-firefox
setup-util-qpdf
used bypdf-decrypt
setup-util-tor-browser
setup-util-trash
: updated for a library that actually works, and uninstall the ones that don'tsetup-util-xcode
: use shapeshifter for the xcode license agreement, as it requires it as it modifies cursorwaiter
: fix missing-n
on--stdout
,--stderr
, and--tty
option handlingconfig/dns.bash
: removed outdated configuration optionsconfig/styles.bash
: fixed terminal resize and end styles not being found due to typodocs/errors.md
: detailed the errors that dorothy actually usessources/nvm.sh
: fix for edge case where nvm fails to detect systemnode
deprecated core commands:
echo-segment
replaced byecho-style
, this was done a year or more ago, before we had the deprecated directoryfs-size
replaced byfs-structure
orget-size
depending on your use caseget-array-*
andis-array-*
commands replaced byecho-trim-empty-lines
yes that is correct and yes it is weird, but those commands were weirdis-array-(empty|full|partial)
replaced byis-whitespace
oris-not-whitespace
is-color-enabled
replaced byget-terminal-color-support --quiet
is-empty-ls
replaced byis-empty-directory
is-empty-string
replaced byis-whitespace
is-nonempty-string
replaced byis-not-whitespace
get-line-count
replaced byecho-count-lines
rm-junk
replaced byfs-trim --cache
rm-modules
replaced byfs-trim --module
deprecated beta commands:
echo-if-empty
replaced byecho-with-whitespace-fallback
echo-if-path
replaced byecho-if-present
is-dir
replaced byis-directory
is-either
replaced byis-needle
is-equal
replaced byis-needle
is-exec
replaced byis-executable
is-neither
replaced by! is-needle
rm-svn
replaced byfind ...
rm-sync
replaced byfind ...
promoted from beta commands:
echo-if-path
promoted toecho-if-present
echo-last-line
echo-values
is-empty-directory
is-even
is-file
demoted to beta commands:
echo-affirmative
find-directories
beta command updates:
echo-if-directory
echo-if-executable
echo-truncate-lines
, however you probably just wanthead -n <lines>
echo-with-empty-fallback
, probably needs to be renamed toecho-with-zero-length-fallback
echo-with-whitespace-fallback
, renamed fromecho-if-empty
eject-all
: usefs-structure
eval-on-empty-stdin
: rewrote for modern conventions, and supportgrep
fallback for whenifne
is not presenteval-on-not-empty-stdin
: rewrote for modern conventionsget-codec
: fix testsis-suffix
: use newbash.bash
helperspdf-decrypt
: rewrote for modern conventionsresearchgate-rename
: useecho-regexp
instead ofpython-regex
, and fixis-same
callrm-vmware
renamed torm-vmware-fusion
setup-server
: updated for newis-*
fs commandsmerges: