fish arguments and functions
- argparse - parse options passed to a fish script or function — fish-shell 4.0.2 documentation
- function - create a function — fish-shell 4.0.2 documentation
Below:
- h/help is a flag
- o/output-dir gets+requires a value
or return
fails on unknown-a/--args
- If found, the value is removed from
$argv
and put into_flag_argname
set -q
uery (tests if var is set)-l
ocal
argparse h/help o/output-dir= -- $argv
or return
if set -ql _flag_help
echo "Usage: script.fish [-o/--output-dir <dir>] <input_files_or_directory>"
echo "Example: script.fish --output-dir /path/to/output file1.png directory_with_pngs/ dir/*.png"
exit 0
end
if set -ql _flag_output_dir
set output_dir $_flag_output_dir
end
for arg in $argv
# do something with file $arg
end
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus