-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
Milestone
Description
fish, version 3.0.2
Currently function takes option -a NAMES (among) others to assign readable names to arguments.
It would be nice if an --flag option was also available which makes use of the built-in argparse command.
Example usage:
function recode -a input --flag "h/help" --flag "e/encoding" -d "use ffmpeg to convert a video file to another format"
if [_$flag_h]
fish_func_help()
end
set extension (string replace -i -r '^.*?(\w*)$' '$1' $input)
set output (string replace -r '\.([^.]*)$' .$_flag_encoding $input).$extension
ffmpeg -i "$input" -c:v $_flag_encoding -c:a copy -c:s copy "$output"
end
Since function is already aware of the name of the function and what options are available for argparse, it should be able to output a nice help message as well (current argparse error is a bit much)
Reactions are currently unavailable