Created
November 29, 2025 05:32
-
-
Save luisadha/15067f073dc050fbf9f362ddcf0b211a to your computer and use it in GitHub Desktop.
molly secara harfiah menamai proyek pet dengan nama anjing (molly) merupakan konfigurasi tambahan untuk proyek pet, meliputi alias and completion
This file contains hidden or 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
| alias molly-come='eval "$(pet search | xargs -r echo)"' | |
| alias molly-speak='pet search | tee /dev/tty | xargs -r echo | termux-tts-speak' | |
| alias molly-jump='eval "$(pet search --query 📁)"' | |
| alias molly-stay='pet list' | |
| alias molly-paw='pet edit' | |
| alias molly-heel='pet sync' | |
| alias molly-settle='pet new' | |
| alias molly-talk="pet list | grep 'Description:' | sed 's/^Description: *[^|]*|//' | grep -v '^$' | fzf | tee /dev/tty | xargs -r echo | termux-tts-speak" | |
| alias molly-bloop='__molly_back' | |
| function pet_select() { | |
| BUFFER=$(pet search --query "$READLINE_LINE") | |
| READLINE_LINE=$BUFFER | |
| READLINE_POINT=${#BUFFER} | |
| } | |
| bind -x '"\C-x\C-r": pet_select' | |
| function __molly_back() { | |
| PREV=$(echo `history | tail -n2 | head -n1` | sed 's/[0-9]* //') | |
| sh -c "pet new -m `printf %q "$PREV"`" | |
| } | |
| molly() { | |
| if [ -z "$MOLLY_DEFAULT_ACTION" ]; then | |
| MOLLY_DEFAULT_ACTION="$( | |
| compgen -a | | |
| grep '^molly-' | | |
| xargs -n 1 basename | | |
| fzf --no-input \ | |
| --header '🐾 Commands for Molly the Dog' \ | |
| --layout=reverse \ | |
| --color=fg:white,fg+:green,query:blue \ | |
| --with-nth=2 --delimiter='-' --nth=1 \ | |
| --info=inline -q "${1:-}" | |
| )" | |
| fi | |
| # kalau hasilnya gak kosong, jalankan | |
| if [ -n "$MOLLY_DEFAULT_ACTION" ]; then | |
| eval "$MOLLY_DEFAULT_ACTION" "$@" | |
| fi | |
| } | |
| _molly_complete() { | |
| local cur="${COMP_WORDS[COMP_CWORD]}" | |
| COMPREPLY=( $(alias | grep '^alias molly-' | cut -d= -f1 | sed 's/^alias molly-//' | grep "^$cur") ) | |
| } | |
| complete -F _molly_complete molly | |
| eval "$(pet completion bash)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment