Interactive Omarchy Command Explorer #5185
sean-imus
started this conversation in
Show and tell
Replies: 1 comment
-
|
Cool and usefull, thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello all,
I wanted to share a command that has helped me many times.
It lists all available omarchy commands and displays their source code in a clean
fzfinterface with abatpreview. Most omarchy commands are self-explanatory because their source files are well commented, and this makes it easy to browse and understand them.The setup is simple and can be used in two ways.
Option 1 (Script)
omarchysunder~/.local/bin(or any directory in your$PATH):omarchyswherever you like.Option 2 (One-liner)
CTRL + Rin your terminal and search for something likefzforcompgento quickly find it again later.Explanation
How does this command work?
compgen -cgenerates all available commands in your shell and passes them to the next command via|grep -E '^omarchy-'filters for commands that begin withomarchy-sort -usorts the results and removes duplicates (important because commands show up multiple times without it)fzfprovides the interactive interface:fzf --style=full --preview --preview-window=right,65%,wrapdefines the layout and enables fuzzy searching"bat --style=numbers --color=always \$(which {})"runs in the preview window and shows the source code of the selected command usingbatNotes
I debated adding functionality to execute the selected command by pressing Enter directly from
fzf. However, this was too risky because some omarchy commands can have serious side effects. Currently, pressing Enter only prints the command name to the terminal.Preview
Beta Was this translation helpful? Give feedback.
All reactions