function catall --description "Print recursively multiple files." # Declare our arguments argparse h/help n/noheader -- $argv # Get function name set current_name $(status current-function) # Check if not enough arguments provided, or help menu if set -ql _flag_help || test -z $argv[2] echo -e "Usage: $current_name exts ..." echo -e " $current_name [-h|--help] \t\t\t - Show this help message" echo -e " $current_name *.c \t\t - Cat all .C files" echo -e " $current_name *.c *.h ... \t - Cat .C and .H files, etc." echo -e "Flag:" echo -e " [-n|-noheader] \t\t\t - Don't show the filenames before print" return 0 end # Define directory set directory $argv[1] # Define extensions set exts -name "$argv[2]" for ext in $argv[3..-1] set -a exts -o -name "$ext" end # Extra args for better printing if not set -ql _flag_noheader set args -exec echo -e "File: {}" \; end set -a args -exec cat {} \; -exec echo "" \; # Print files find $directory \( $exts \) $args end