commit d2cef582c7ab67cd78049d0ba677c678f3bfe69b Author: jez Date: Tue Apr 18 15:00:51 2023 -0400 add: direnv config diff --git a/README.md b/README.md new file mode 100644 index 0000000..4a2ebb6 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# user/id-mrjk +Just a bunch of dotfiles. + +## Install +Clone and symlink or install with [ellipsis][ellipsis]: + +``` +$ ellipsis install user/id-mrjk +``` + +[ellipsis]: http://ellipsis.sh + diff --git a/ellipsis.sh b/ellipsis.sh new file mode 100644 index 0000000..75822f9 --- /dev/null +++ b/ellipsis.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +# +# user/id-mrjk ellipsis package + + +ELLIPSIS_SHELL_BIN="$HOME/.local/bin" +ELLIPSIS_SHELL_= + +detect_platform() { + local kernel= machine= + + kernel=$(uname -s | tr "[:upper:]" "[:lower:]") + case "${kernel}" in + mingw*) + kernel=windows + ;; + esac + case "$(uname -m)" in + x86_64) + machine=amd64 + ;; + i686 | i386) + machine=386 + ;; + aarch64 | arm64) + machine=arm64 + ;; + *) + >&2 echo "Machine $(uname -m) not supported by the installer.\n" \ + "Go to https://direnv for alternate installation methods." + return 1 + ;; + esac + + echo "machine='$machine'; kernel='$kernel';" +} + +get_github_release () { + local repo=$1 + local pattern=$2 + local version=${3:-latest} + + if [[ -n "${version:-}" ]]; then + gh_url_suffix="tags/${version}" + else + gh_url_suffix="latest" + fi + + download_url=$( + curl -fL "https://api.github.com/repos/direnv/direnv/releases/$gh_url_suffix" \ + | grep browser_download_url \ + | cut -d '"' -f 4 \ + | grep "$pattern" + ) + +} + +# The following hooks can be defined to customize behavior of your package: +pkg.install() { + fs.link_files $PKG_PATH + + eval "$(detect_platform)" + download_url=$(get_github_release direnv/direnv "direnv.$kernel.$machine" latest) + + #download_url=$( + # curl -fL "https://api.github.com/repos/direnv/direnv/releases/$gh_url_suffix" \ + # | grep browser_download_url \ + # | cut -d '"' -f 4 \ + # | grep "direnv.$kernel.$machine" + #) + + mkdir -p "$ELLIPSIS_SHELL_BIN" + curl -o "$ELLIPSIS_SHELL_BIN/direnv" -fL "$download_url" + chmod a+x "$ELLIPSIS_SHELL_BIN/direnv" + set +x + +} + +# pkg.push() { +# git.push +# } + +# pkg.pull() { +# git.pull +# } + +# pkg.installed() { +# git.status +# } +# +# pkg.status() { +# git.diffstat +# } +