function lookfor --description "Lookfor (d)irectory, (f)ile (a)ll (pattern)"
    if test (count $argv) -lt 2
        echo "Usage: lookfor (f)ile|(d)irectory|(a)ll \"pattern\""
        return 1
    end

    set -l type_flag $argv[1]
    set -l pattern $argv[2]

    switch $type_flag
        case f
            find . -type f -name "*$pattern*" 2>/dev/null
        case d
            find . -type d -name "*$pattern*" 2>/dev/null
        case a
            find . -name "*$pattern*" 2>/dev/null
        case *
            echo "Invalid type: $type_flag. Use f for file or d for directory."
            return 1
    end
end
