Created
January 19, 2022 18:22
-
-
Save Ezku/4f49426266078510ed4d781dca2bed1b to your computer and use it in GitHub Desktop.
Applications/raycast-script-commands/Justfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env just | |
default: | |
just -l | |
# Update this git repository | |
update: | |
git fetch --depth 1 && git reset --hard origin/master | |
# Find available commands | |
commands query="": | |
find commands -type d -depth 2 \ | |
| fzf \ | |
--preview="tree -L 1 ./{}" \ | |
--delimiter "/" \ | |
--with-nth="2..-1" \ | |
--query="{{query}}" | |
# Symlink from `commands` to `_enabled_commands` | |
install query="": | |
ln -sf $(pwd)/$(just commands {{query}}) $(pwd)/_enabled-commands/. | |
just refresh enabled | |
uninstall: | |
just select-enabled-plugin "rm" | xargs rm | |
just refresh enabled | |
select-enabled-plugin pointer=">": | |
find $(pwd)/_enabled-commands -type l -depth 1 \ | |
| fzf \ | |
--delimiter "/" \ | |
--with-nth="-1" \ | |
--pointer="{{pointer}}" | |
# List directories symlinked to `_enabled_commands` | |
enabled: | |
tree _enabled-commands/ -L 1 -d -t | |
# Clean up `_enabled_commands`, then copy assets from symlinked directories | |
refresh: | |
just clean && just copy | |
clean: | |
find _enabled-commands \ | |
-type f \ | |
-not -path '*/\.*' \ | |
| xargs rm | |
git checkout _enabled-commands | |
copy: | |
(cd _enabled-commands && cp -r ./*/* .) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment