diff options
author | Toby Vincent <tobyv13@gmail.com> | 2022-03-26 20:23:37 -0500 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2022-03-26 20:23:37 -0500 |
commit | 9d02e5c66688d79ba2a9cd089d5ee851ea43c316 (patch) | |
tree | 3791acb87636f950d18e432cae8e68b7aeb786f3 | |
parent | c30bb495db716a68f8ae98e531857c545c0505d9 (diff) |
refactor: migrate from just to make
-rw-r--r-- | justfile | 91 | ||||
-rw-r--r-- | makefile | 86 |
2 files changed, 86 insertions, 91 deletions
diff --git a/justfile b/justfile deleted file mode 100644 index fb6305c..0000000 --- a/justfile +++ /dev/null @@ -1,91 +0,0 @@ -# set positional-arguments := true - -EMAIL := 'tobyv13@gmail.com' -ZSH_COMP_DIR := join(env_var('HOME'), '/.local/share/zsh/site-functions') -BASH_COMP_DIR := join(env_var('HOME'), '/.local/share/bash-completion/completions') - -stow: - stow --target={{ env_var('HOME') }} */ - -unstow: - stow --target={{ env_var('HOME') }} --delete */ - -install +TARGETS: - for target in {{TARGETS}}; do just $target; done - -rustup: - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path - rustup completions bash >{{ BASH_COMP_DIR }}/completions/rustup; - rustup completions zsh >{{ ZSH_COMP_DIR }}/_rustup; - rustup completions bash cargo >{{ BASH_COMP_DIR }}/completions/cargo; - rustup completions zsh cargo >{{ ZSH_COMP_DIR }}/_cargo) - -cargo: - command -v cargo || just rustup - command -v cargo-quickinstall || cargo install cargo-quickinstall - -starship: cargo - cargo quickinstall starship --locked - starship completions bash >{{ BASH_COMP_DIR }}/completions/starship; - starship completions zsh >{{ ZSH_COMP_DIR }}/_starship - -# Install manually with cargo see https://github.com/sharkdp/bat/issues/2106 -bat: - cargo quickinstall bat --target {{ arch() }}-unknown-{{ os() }}-mus - curl -sL https://raw.githubusercontent.com/sharkdp/bat/master/assets/completions/bat.bash.in >{{ BASH_COMP_DIR }}/completions/bat - curl -sL https://raw.githubusercontent.com/sharkdp/bat/master/assets/completions/bat.zsh.in >{{ ZSH_COMP_DIR }}/_bat - -fd: - cargo quickinstall fd-find - curl -sL https://raw.githubusercontent.com/sharkdp/fd/master/contrib/completion/_fd >{{ ZSH_COMP_DIR }}/_fd - -ripgrep: - cargo install ripgrep - curl -sL https://raw.githubusercontent.com/BurntSushi/ripgrep/master/complete/_rg >{{ ZSH_COMP_DIR }}/_rg - -chtsh: - curl https://cht.sh/:cht.sh >~/.local/bin/cht.sh - chmod +x ~/.local/bin/cht.sh - curl https://cht.sh/:bash_completion >{{ BASH_COMP_DIR }}/completions/cht - curl https://cheat.sh/:zsh >{{ ZSH_COMP_DIR }}/_cht - -git-open: - curl -sL "https://raw.githubusercontent.com/paulirish/git-open/master/git-open" >~/.local/bin/git-open && - chmod +x ~/.local/bin/git-open; - -gh: - #!/usr/bin/env bash - set -euxo pipefail - td=$(mktemp -d) - arch="$(uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/ | sed s/armv7l/armv6/)" - tag="$(curl -sI https://github.com/cli/cli/releases/latest | grep -Po 'tag\/v?\K(\S+)')" - name="gh_${tag}_linux_${arch}" - url="https://github.com/cli/cli/releases/latest/download/${name}.tar.gz" - curl -sL $url | tar -C $td -xz - test -x $td/$name/bin/gh - install -Dm 755 $td/$name/bin/gh ~/.local/bin/gh - rm -rf $td - gh completion --shell bash >{{ BASH_COMP_DIR }}/gh - gh completion --shell zsh >{{ ZSH_COMP_DIR }}/_gh - -fzf: - #!/usr/bin/env sh - set -euxo pipefail - td=$(mktemp -d) - tag="$(curl -sI https://github.com/junegunn/fzf/releases/latest | grep -Po 'tag\/v?\K(\S+)')" - alt_arch="$(echo {{arch()}} | sed s/aarch64/arm64/ | sed s/x86_64/amd64/ | sed s/armv7l/armv7/)" - name="fzf-${tag}-{{ os() }}_${alt_arch}" - url="https://github.com/junegunn/fzf/releases/latest/download/${name}.tar.gz" - curl -sL $url | tar -C $td -xz - test -x $td/fzf - rm -f ~/.local/bin/fzf - install -Dm 755 $td/fzf ~/.local/bin/fzf - rm -rf $td - curl -sL https://raw.githubusercontent.com/junegunn/fzf/master/shell/completion.bash >{{ BASH_COMP_DIR }}/completions/fzf - curl -sL https://raw.githubusercontent.com/junegunn/fzf/master/shell/completion.zsh >{{ ZSH_COMP_DIR }}/_fzf - curl -sL https://raw.githubusercontent.com/junegunn/fzf/master/shell/key-bindings.bash >~/.bash/fzf-key-bindings.sh - curl -sL https://raw.githubusercontent.com/junegunn/fzf/master/shell/key-bindings.zsh >~/.zsh/fzf-key-bindings.zsh - -gpg: - gpg --auto-key-locate keyserver --locate-keys {{ EMAIL }} - gpg --import-ownertrust {{ join(env_var('HOME'), '.gnupg/trustfile.txt') }} diff --git a/makefile b/makefile new file mode 100644 index 0000000..a525dd0 --- /dev/null +++ b/makefile @@ -0,0 +1,86 @@ +VPATH = $(PATH) +ZSH_COMP_DIR := $(HOME)/.local/share/zsh/site-functions +BASH_COMP_DIR := $(HOME)/.local/share/bash-completion/completions +ARCH := $(shell uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/ | sed s/armv7l/armv6/) + +gpg: EMAIL := tobyv13@gmail.com + +stow: + stow --target=$(HOME) */ + +unstow: + stow --target=$(HOME) --delete */ + +cargo rust: + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path + rustup completions bash >$(BASH_COMP_DIR)/rustup; + rustup completions zsh >$(ZSH_COMP_DIR)/_rustup; + rustup completions bash cargo >$(BASH_COMP_DIR)/cargo; + rustup completions zsh cargo >$(ZSH_COMP_DIR)/_cargo) + +cargo-quickinstall: cargo + cargo install cargo-quickinstall + +starship: cargo-quickinstall + cargo quickinstall starship + starship completions bash >$(BASH_COMP_DIR)/starship; + starship completions zsh >$(ZSH_COMP_DIR)/_starship + +sheldon: cargo-quickinstall + cargo quickinstall sheldon + sheldon completions --shell bash >$(BASH_COMP_DIR)/sheldon; + sheldon completions --shell zsh >$(ZSH_COMP_DIR)/_sheldon + +bat: cargo-quickinstall + cargo quickinstall bat --target $(arch())-unknown-$(os())-mus + curl -sL https://raw.githubusercontent.com/sharkdp/bat/master/assets/completions/bat.bash.in >$(BASH_COMP_DIR)/bat + curl -sL https://raw.githubusercontent.com/sharkdp/bat/master/assets/completions/bat.zsh.in >$(ZSH_COMP_DIR)/_bat + +fd: cargo-quickinstall + cargo quickinstall fd-find + curl -sL https://raw.githubusercontent.com/sharkdp/fd/master/contrib/completion/_fd >$(ZSH_COMP_DIR)/_fd + +rg: cargo-quickinstall + cargo quickinstall ripgrep + curl -sL https://raw.githubusercontent.com/BurntSushi/ripgrep/master/complete/_rg >$(ZSH_COMP_DIR)/_rg + +chtsh: + curl https://cht.sh/:cht.sh >$(HOME)/.local/bin/cht.sh + chmod +x $(HOME)/.local/bin/cht.sh + curl https://cht.sh/:bash_completion >$(BASH_COMP_DIR)/cht + curl https://cheat.sh/:zsh >$(ZSH_COMP_DIR)/_cht + +git-open: + curl -sL "https://raw.githubusercontent.com/paulirish/git-open/master/git-open" >$(HOME)/.local/bin/git-open && + chmod +x $(HOME)/.local/bin/git-open; + +gh: + $(eval TEMP := $(shell mktemp -d)) + $(eval TAG := $(shell curl -sI https://github.com/cli/cli/releases/latest | grep -Po 'tag\/v?\K(\S+)')) + curl -sL https://github.com/cli/cli/releases/latest/download/gh_$(TAG)_linux_$(ARCH).tar.gz | tar -C $(TEMP) -xz + test -x $(TEMP)/gh_$(TAG)_linux_$(ARCH)/bin/gh + install -Dm 755 $(TEMP)/gh_$(TAG)_linux_$(ARCH)/bin/gh $(HOME)/.local/bin/gh + rm -rf $(TEMP) + gh completion --shell bash >$(BASH_COMP_DIR)/gh + gh completion --shell zsh >$(ZSH_COMP_DIR)/_gh + +fzf: + TEMP=$(mktemp -d) + $(eval TAG := $(shell curl -sI https://github.com/junegunn/fzf/releases/latest | grep -Po 'tag\/v?\K(\S+)')) + curl -sL https://github.com/junegunn/fzf/releases/latest/download/fzf-${TAG}-linux_$(ARCH).tar.gz | tar -C $(TEMP) -xz + test -x $(TEMP)/fzf + rm -f $(HOME)/.local/bin/fzf + install -Dm 755 $(TEMP)/fzf $(HOME)/.local/bin/fzf + rm -rf $(TEMP) + +.PHONY: gpg wsl clean + +gpg: + gpg --auto-key-locate keyserver --locate-keys $(EMAIL) + gpg --import-ownertrust $(HOME)/.gnupg/trustfile.txt + +wsl: + ./wsl/install.sh + +clean: + echo "TODO"
\ No newline at end of file |