Open
Description
What do you need?
Guide is for Linux environment.
Step 1
Create or modify .bash_aliases:
sudo nano ~/.bash_aliases
Step 2
Create function that do searching the fabric pattern name or displaying the content of selected pattern:
`pname() {
local pattern_dir="$HOME/.config/fabric/patterns"
# Check if a pattern name was provided
if [[ -z "$1" ]]; then
echo -e "\e[31mError:\e[0m Please provide a pattern name."
return 1
fi
# Exact match check
if [[ -d "$pattern_dir/$1" ]]; then
echo -e "\e[32mPattern found:\e[0m $1"
cat "$pattern_dir/$1/system.md"
return 0
fi
# No exact match, suggest closest matches
local matches=$(ls "$pattern_dir" | grep -i "$1" | sort)
if [[ -n "$matches" ]]; then
echo -e "\e[33mPattern '$1' not found. Did you mean?\e[0m"
echo "$matches" | column
else
echo -e "\e[31mNo matching patterns found.\e[0m"
fi
}`
Step 3
Save file. Refresh terminal. Por favor - everything should be ready. In the image an example of using it.