danielmiessler / fabric

fabric is an open-source framework for augmenting humans using AI. It provides a modular framework for solving specific problems using a crowdsourced set of AI prompts that can be used anywhere.
https://danielmiessler.com/p/fabric-origin-story
MIT License
25.52k stars 2.71k forks source link

:sparkles: Added unaliasing to pattern setup #1123

Closed polyglotdev closed 1 week ago

polyglotdev commented 2 weeks ago

In the process of setting up patterns, we've added a step to unalias any existing alias with the same name. This ensures that our dynamically defined functions won't conflict with any pre-existing aliases.

What this Pull Request (PR) does

During the setup of fabric I added the obsidian vault bits and received this error after sourcing my ~/.zshrc

 (eval):2: defining function based on alias `agility_story'
    (eval):2: parse error near `()'
    (eval):2: defining function based on alias `ai'
    (eval):2: parse error near `()'
    (eval):2: defining function based on alias `analyze_answers'
    (eval):2: parse error near `()'
    (eval):2: defining function based on alias `analyze_cfp_submission'
    (eval):2: parse error near `()'
    (eval):2: defining function based on alias `analyze_claims'
    (eval):2: parse error near `()'
    (eval):2: defining function based on alias `analyze_comments'
    (eval):2: parse error near `()'
    (eval):2: defining function based on alias `analyze_debate'
.... cut for brevity

The unalias "$pattern_name" 2>/dev/null command removes any existing alias with the same name as the function you're about to define. The 2>/dev/null part suppresses any error messages if the alias doesn't exist, ensuring the script runs smoothly.

Related issues

n/a

Screenshots

After sourcing with initial command: --llan~projectsfabric 2024-11-08 at 11 25 54 AM

After corrected script: --llan~projectsfabric 2024-11-08 at 11 27 24 AM