Giter VIP home page Giter VIP logo

bevry / dorothy Goto Github PK

View Code? Open in Web Editor NEW
259.0 11.0 21.0 6.66 MB

๐Ÿง™๐Ÿปโ€โ™€๏ธ Bring your dotfile commands and configuration to any shell. Sensible defaults and hundreds of commands preloaded. Supports Bash, Zsh, Fish, Nu, Xonsh, Elvish, Dash, KornShell, macOS, Linux, Windows.

License: Other

Shell 98.99% JavaScript 0.02% Python 0.10% TypeScript 0.01% Nushell 0.31% Xonsh 0.30% Elvish 0.28%
dotfiles zsh bash fish-shell shell linux macos cli fish dotfiles-linux

dorothy's Issues

organisation configuration repositories

Dorothy is robust enough to allow an organisation to create its own configuration repository and have it shared and utilised amongst its employees.

The steps would be like so:

  1. clone your org's dotfiles to $DOROTHY_USER_HOME/org
  2. source them in your config files
  3. add echo_var_add PATH "$DOROTHY_USER_HOME/org/commands" to your config/environment.bash

If there is an organisation that would like to share configuration in such a way, then grab a support call with @balupton and we'll get you setup.

Eventually, tooling could be provided to streamline such, and allow multiple repositories to be easily sourced and shared.

`setup-git` gpg failed to sign

Next step for me is also to trouble shoot this. After running setup-git I gets;

error: gpg failed to sign the data
fatal: failed to write commit object

when commiting which means that commiting doesn't work at all.

I could probably go into my user configs and un check this for now.

It was a while ago that I read up on gpg so ย I have to refresh my memory on that. I do know however, that I have
a valid master key that exists. I have to walk through the code also to see how you use gpg in dorothy.

Installation not working because of dependency on `choose-option`

I don't know if I'm doing something wrong but the instructions both for trying out dorothy and for installing it seems to depend on choose-option (which obviously does not exist without dorothy installed)

 ! ๎‚ฐ ~ ๎‚ฐ bash -ic "$(curl -fsSL https://dorothy.bevry.workers.dev/commands/what-is-my-ip)"                                                                                       3021ms ๎‚ณ Mon Mar 28 16:46:54 2022
bash: choose-option: command not found

! ๎‚ฐ ~ ๎‚ฐ bash -ilc "$(curl -fsSL https://raw.githubusercontent.com/bevry/dorothy/master/commands/dorothy)"                                                                        281ms ๎‚ณ Mon Mar 28 16:48:29 2022
bash: choose-option: command not found

Platform details (I don't think it is relevant): Tried on macOS w/ Apple Silicon 12.3 with fish and bash.

Streamlined Arch Support

I was able to get Dorothy running on Arch today, however what has been committed was just the end result. There were also manual adjustments here and there, that I need to review the CLI history and make note of, to see what can be automated.

One aspect of automation here would be to re-add the automatic installation of dependencies, rather than having them listed in the README.md file.

Improvement: have new login shell instances output sponsors, funders, contributors

It would be nice to say thank you to Bevry's sponsors, funders, and contributors.

For sponsors, funders, and contributors, there would be an easy command to run to opt out of this. Otherwise there will be a non-documented ability to opt out.

Ideas for when to display this:

  • opening a new terminal, limited to once a day
  • upon setup-dorothy, limited to once a day

Complete styling changes

I've updated several commands, but there are still a lot to go.

Completed:

  • alias-*
  • is-same
  • setup-go
  • setup-mac
  • setup-mac-brew
  • setup-util
  • setup-utils
  • setup-util-gocryptfs

We should start with the setup-* workflow and work backwards from there.

GPG Pinentry on macOS

For what it seems gpg with pinentry is not working properly for me on
macOS. Personally, I have read through the setup-git command and feel like
I understand it fyi. But I have to read through it a couple more times
to really feel like I understand everything.

I searched for neovim pinentry and found this plugin issue. Maybe it
will reveal some interesting information:

resources

jamessan/vim-gnupg#32
https://github.com/jamessan/vim-gnupg
https://gist.github.com/troyfontaine/18c9146295168ee9ca2b30c00bd1b41e

disable terminal bell

I had

# disable the annoying terminal bell
# http://superuser.com/a/1123198/32418
local TERMINAL_PLIST
local TERMINAL_THEME
TERMINAL_PLIST="$HOME/Library/Preferences/com.apple.Terminal.plist"
TERMINAL_THEME=$(/usr/libexec/PlistBuddy -c "Print 'Default Window Settings'" "$TERMINAL_PLIST")
/usr/libexec/PlistBuddy -c "Set 'Window Settings':$TERMINAL_THEME:Bell false" "$TERMINAL_PLIST"
/usr/libexec/PlistBuddy -c "Set 'Window Settings':$TERMINAL_THEME:VisualBellOnlyWhenMuted false" "$TERMINAL_PLIST"

But it produces:

Set: Entry, "Window Settings:Basic:Bell", Does Not Exist
Set: Entry, "Window Settings:Basic:VisualBellOnlyWhenMuted", Does Not Exist		

On new machines, should remove it until I figure out a solution that works.

Adoption Support

Hi there,

First of all I want to say that I am very happy that I found this project and it looks amazing!
I found it when searching for a better reason differentiate between intel mac and M1 in bash.
I saw that you are using uname -a which is cool!

Question: Can I use this project on arch based linux distros. Have you tested it on that?

Currently I am a mac user myself but I am very much looking into migrating over to arch for various reasons.

`setup-mac-brew` error: `fatal: --unshallow on a complete repository does not make sense`

โ•ฐ๏‘  setup-mac-brew

Homebrew is installed.

Updating homebrew...
fatal: --unshallow on a complete repository does not make sense
fatal: --unshallow on a complete repository does not make sense
fatal: --unshallow on a complete repository does not make sense
fatal: --unshallow on a complete repository does not make sense
fatal: --unshallow on a complete repository does not make sense

l ran the command earlier today and then everything seems to have install pretty much.

full stdout

โ•ฐ๏‘  setup-mac-brew

Homebrew is installed.

Updating homebrew...
fatal: --unshallow on a complete repository does not make sense
fatal: --unshallow on a complete repository does not make sense
fatal: --unshallow on a complete repository does not make sense
fatal: --unshallow on a complete repository does not make sense
fatal: --unshallow on a complete repository does not make sense
Updated 1 tap (homebrew/core).
No changes to formulae.
==> Casks with 'auto_updates true' or 'version :latest' will not be upgraded; pass `--greedy` to upgrade them.
==> Upgrading 5 outdated packages:
criptext latest -> 0.31.0,2.0.82
drawio 13.0.3 -> 15.4.0
keepassxc 2.5.4 -> 2.6.6
reaper 6.38 -> 6.40
teensy latest -> 1.52
==> Upgrading criptext
==> Downloading https://cdn.criptext.com/Criptext-Email-Desktop/mac/Criptext-latest.dmg
Already downloaded: /Users/hjalmarjakobsson/Library/Caches/Homebrew/downloads/bd6e0fcb366006e5044fd7b38e06562c34dd1a316eeccbe7f2a592c5b3f82bb5--Criptext-latest.dmg
Warning: No checksum defined for cask 'criptext', skipping verification.
==> Purging files for version 0.31.0,2.0.82 of Cask criptext
==> Upgrading drawio
==> Downloading https://github.com/jgraph/drawio-desktop/releases/download/v15.4.0/draw.io-x64-15.4.0.dmg
Already downloaded: /Users/hjalmarjakobsson/Library/Caches/Homebrew/downloads/a8cbe9b1b0b8e98a138e3484edac0d18c4615975939f4cb4e18798fdb92699a9--draw.io-x64-15.4.0.dmg
==> Purging files for version 15.4.0 of Cask drawio
==> Upgrading keepassxc
==> Downloading https://github.com/keepassxreboot/keepassxc/releases/download/2.6.6/KeePassXC-2.6.6-x86_64.dmg
Already downloaded: /Users/hjalmarjakobsson/Library/Caches/Homebrew/downloads/20540289404e2e1b827e38fa1344f1beb52e4d8fdbb0b948190e1d0ff1a79c59--KeePassXC-2.6.6-x86_64.dmg
==> Purging files for version 2.6.6 of Cask keepassxc
==> Upgrading reaper
==> Downloading https://www.reaper.fm/files/6.x/reaper640_x86_64_catalina.dmg
Already downloaded: /Users/hjalmarjakobsson/Library/Caches/Homebrew/downloads/9d8f7dbc63baad5af5f82f55a3df5a785808850f32c6e17f00b10afb1c3e3177--reaper640_x86_64_catalina.dmg
==> Purging files for version 6.40 of Cask reaper
==> Upgrading teensy
==> Downloading https://www.pjrc.com/teensy/teensy.dmg
Already downloaded: /Users/hjalmarjakobsson/Library/Caches/Homebrew/downloads/c578eda858c81809f9e4afc923f88f090d5c666de34faa2c8112f7d39ea87e14--teensy.dmg
Warning: No checksum defined for cask 'teensy', skipping verification.
==> Purging files for version 1.52 of Cask teensy
Error: Problems with multiple casks:
criptext: It seems there is already an App at '/usr/local/Caskroom/criptext/latest/Criptext.app'.
drawio: It seems there is already an App at '/usr/local/Caskroom/drawio/13.0.3/draw.io.app'.
keepassxc: It seems there is already an App at '/usr/local/Caskroom/keepassxc/2.5.4/KeePassXC.app'.
reaper: It seems the App source '/Users/hjalmarjakobsson/reaper/app/RPPTEST/REAPER.app' is not there.
teensy: It seems there is already an App at '/usr/local/Caskroom/teensy/latest/teensy.app'.

Create new `dorothy` command

Task to track the following changes:

  • create commands/dorothy
  • setup-dorothy -> dorothy setup, dorothy install, dorothy update, dorothy trial
  • setup-dorothy-permissions -> dorothy perms
  • edit-dorothy -> dorothy edit, dorothy review
  • select-theme -> dorothy theme
  • dorothy trial [shell=zsh|bash|fish] will create an interactive trial subshell

Other ecosystem tasks:

  • ensure the trial mode cloudflare worker is updated to reflect the move
  • ensure the install instructions is updated to reflect the move

Redo `echo-lines` backlashes with `<<-EOF`

This trims indentation:

	cat <<-EOF
		NAME
		     transcrypt -- transparently encrypt files within a git repository
		EOF

This does not trim indentation:

	cat << EOF
		NAME
		     transcrypt -- transparently encrypt files within a git repository
EOF

While we are at it, we could also replace stderr with >&2 perhaps.

If a `SETUP_UTILS` item is missing, the error is not helpful.

when running setup-utils for some packages in setup.bash it returns this:

/Users/hjalmarjakobsson/.local/share/dorothy/commands/setup-utils: line 12: setup-util-lua: command not found

What does this mean. I mean, lua is found on my system so what does this message indicate. I am thinking that I should probably put these commands under brew. But I thought the purpose of setup-utils was to install stuff that should go with any package manager available kind of, I'm not hundred sure.

`--help` flags for each of the commands

Remaining help text to be applied:

  • echo-*
  • is-*
  • eval-no-color multi args
  • eval-on-empty-stdin multi args
  • eval-on-not-empty-stdin multi args
  • expand-path multi args
  • expand-path-bash multi args
  • fs-join two args
  • fs-volume-join two args - moved into macos-state where it is used
  • get-arch no args
  • get-array single arg
  • get-command special args
  • get-line-count zero args, only stdin
  • get-local-to-remote single arg
  • openssl-helper needs help text filled in
  • setup-*

Feel free to send PRs

xps2pdf: "ERROR: invalid date/time" workaround (comment out a few lines on macos)...

On macos 10.14 I got ctime error:


bash-3.2$ brew install ghostscript

bash-3.2$ which gxps
/usr/local/bin/gxps
bash-3.2$ gxps --version
Unrecognized switch: --version
Usage: gxps [option* file]+...
Options: -dNOPAUSE -E[#] -h -L<PCL|PCLXL> -K<maxK> -l<PCL5C|PCL5E|RTL> -Z...
         -sDEVICE=<dev> -g<W>x<H> -r<X>[x<Y>] -d{First|Last}Page=<#>
         -H<l>x<b>x<r>x<t> -dNOCACHE
         -sOutputFile=<file> (-s<option>=<string> | -d<option>[=<value>])*
         -J<PJL commands>
Version: 9.27...

$ xps2pdf.bash mb09.xps 
converting 1 files
converting mb09.xps to mb09.pdf
setting creation time
/usr/local/bin/xps2pdf.bash: line 57: local: can only be used in a function
ERROR: invalid date/time

Workaround was to comment out these lines. (To preserve file dates maybe rewrite with touch)

#	if command_exists GetFileInfo && command_exists SetFile; then
#		echo "setting creation time"
#		local ctime=$(GetFileInfo -m "$xps")
#		SetFile -d "$ctime" "$pdf"
#	fi

Now it works fine even with non-fatal warning on mb07.xps (which was saved from Word 2007).

bash-3.2$ xps2pdf.bash *.xps
converting 9 files
converting mb01.xps to mb01.pdf
converting mb02.xps to mb02.pdf
converting mb03.xps to mb03.pdf
converting mb04.xps to mb04.pdf
converting mb05.xps to mb05.pdf
converting mb06.xps to mb06.pdf
converting mb07.xps to mb07.pdf
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB
converting mb08.xps to mb08.pdf
converting mb09.xps to mb09.pdf
bash3-2$ . open  mb07.pdf 

The 9 xps test files are free from https://www.qualitylogic.com/knowledge-center/news-events/free-sample-xps-files/ if you provide an email, then send you link to download a 14meg zip file with them as "Free XPS test files.zip"

separate Cloudflared Tunnel from Cloudflared DNS Proxy

Several of my ubuntu server machines are using custom DNS, yet need Cloudflare Tunnels, so either:

  1. Use cloudflared to proxy to the custom DNS upstream
  2. Use cloudflared to proxy to the custom DNS upstream in addition to the local custom DNS service
  3. Separate cloudflared tunnel functionality from the setup-dns stuff

make it so that other users can get updates without needing to fork and merge

currently the dotfiles are customised specifically to my desired apps and configurations for them, leaving other users needing to fork and merge to customise their own setups

if the following is done, then the forking and merging would no longer be necessary, making adoption easier and more streamlined:

  • move desired apps to be installed into env vars
  • move desired editor extensions to be installed into env vars
  • move desired ruby, node, python apps into env vars
  • move shell preference into env vars
  • have my env vars preinstalled by default, which users can easily opt out of or inherit
    • users/balupton.sh which is sourced via the init scripts using source "users/$(whoami).sh"
    • prompted to inherit it at install time

setup-util: output progress as it happens, then compress successes

The changes for #74 of 0f4feb1#diff-ead7a0488f9916b329702cc9a9ff126556efc9810270a9382051adebeb0d4e12 has made it so that logs do not happen as they happen, but only after they have finished. This means say running setup-util-tealdeer on a linux arm machine, where tldr doesn't exist, will try two options that are quick, and then do cargo. Cargo takes forever, and there is no output of progress to the user.

As such, we should use the alt tty stuff, (... or something else ...) to make it so that current progress is output to the tty, that is then cleared upon completion, with only significant logs being retained.

Move out gocryptfs vault upgrade code from `sharebox` command

A signficant portion of the sharebox command is dealing with safely upgrading a gocryptfs vault from one version to another - notably ensuring everything is unmounted and whatnot. However, for the actual upgrade code, we could abstract that out into something more generic, such as gocryptfs-upgrade [vault location] which is then called by the sharebox command.

XDG Base Directories

https://wiki.archlinux.org/title/XDG_Base_Directory

Any of these seem the way it could be done:

  • ~/.dorothy including user goes to ${XDG_DATA_HOME:-"$HOME/.local/share"}

  • ~/.dorothy goes to ${XDG_DATA_HOME:-"$HOME/.local/share"} and user goes to ${XDG_CONFIG_HOME :-"$HOME/.config"}

However, perhaps we use this an opportunity to rethink the user part #22, and the config part #17 of dorothy.

If directories are split, then we would need to provide a VSCode Workspace which ties in all the directories together, so make working on dorothy easy.

Another approach to this would be to ask the user in setup-dorothy where they want Dorothy to go, which then determines where dorothy is cloned to and where the login shell init script configuration point to.

In the meantime, one could mv Dorothy to ${XDG_DATA_HOME:-"$HOME/.local/share"}/dorothy and update the login shell configuration to load that, and it all should just work, as DOROTHY unless set manually will be determined from wherever the init script resides.

macos-intel: goinstall command not found

i am just documenting what happnes when I run scripts.

โ•ฐ๏‘  setup-go

Ensuring go is installed...
The [go] utility is already installed because [go] is present. All good. โœ…

Reload paths to ensure go is detected...

Installing 1 go packages...
changkun.de/x/rmtrash imports
        flag: package flag is not in GOROOT (/usr/local/Cellar/go/1.16.3/libexec/src/flag)
changkun.de/x/rmtrash imports
        fmt: package fmt is not in GOROOT (/usr/local/Cellar/go/1.16.3/libexec/src/fmt)
changkun.de/x/rmtrash imports
        os: package os is not in GOROOT (/usr/local/Cellar/go/1.16.3/libexec/src/os)
changkun.de/x/rmtrash imports
        os/user: package os/user is not in GOROOT (/usr/local/Cellar/go/1.16.3/libexec/src/os/user)
changkun.de/x/rmtrash imports
        path/filepath: package path/filepath is not in GOROOT (/usr/local/Cellar/go/1.16.3/libexec/src/path/filepath)
changkun.de/x/rmtrash imports
        time: package time is not in GOROOT (/usr/local/Cellar/go/1.16.3/libexec/src/time)
The [go:changkun.de/x/rmtrash] utility was unable to be installed. โŒ

Update all go packages? (y/N)
go get: cannot match "all": go.mod file not found in current directory or any parent directory; see 'go help modules'

Install go linting packages? (y/N)
/Users/hjalmarjakobsson/.local/share/dorothy/commands/setup-go: line 61: goinstall: command not found

i haven't really used go so I am familiar yet with some of these error messages etc. but I am posting here just so you
can see what the output is.

allow editor configurations to be customisable by the user

Currently vim, atom, and vscode configurations are mine and there isn't a way to customise them besides forking.

Possible Proposal:

  • have .vimrc, .atom, and .vscode symlink inside .scripts/users/$(whoami)/
  • change .scripts/users/balupton.sh to .scripts/users/balupton/source.sh
  • update the dotfile installation script to symlink the directory, instead of its current approach

user commands that extend dorothy commands

Dorothy prefers user commands to its own commands, allowing users to extend the functionality of the built in dorothy commands.

For instance, if you want to display a whisper emote before silencing output with silent, you can:

touch "$DOROTHY_USER_HOME/commands/silent"
chmod +x "$DOROTHY_USER_HOME/commands/silent"
edit "$DOROTHY_USER_HOME/commands/silent"

then set it to

#!/usr/bin/env bash
echo '๐Ÿคซ' > /dev/tty
"$DOROTHY/commands/silent" "$@"

then run it just like before:

silent echo 'do you hear me?'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.