Fish shell

My functions

Work

goes to a project directory where the first argument is a sub-string of that directory

function work
    set target $argv[1]
    set work_dir ~/Projects
    set is_project 0
    for dir_path in "$work_dir"/*
        set dir_name (basename $dir_path)
        if test (string match -i "*$target*" $dir_name )
            cd $dir_path
            echo "Project: $dir_name"
            set is_project 1
            break
        end
    end
    if test $is_project = 0
        echo "no project match found for '$target'"
    end
end