function ensure_path --description "Ensures directories are in $PATH" for pathdir in $argv if not set -l index (contains -i $pathdir $PATH) set -g -x PATH $pathdir $PATH end end end