good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I have a cli script that takes as arguments a file path, and optionally, some switches. I am using Getopt::Std right now. I was having some trouble with the interface. I wanted the user to have to specify switches (-f-a -w hatever) - but I wanted the script to catch any ARGV that does not have a switch and take it as a file argument.. I wanted the following to be valid ways to call the script: script ./thisfile -f -a Getopt::Std allows me to do this.. but if I specify the arguments first, then the file arguments This is where I get the options..
Upon further reading, I see that it is widely recomended (for example in Getopt:Long ) that one provide switch arguments first, and then a file list.. I think in the case of this script I'm working on.. It may be more convenient to specify path first. The script is an interface to showing and editing metadata on a file or directory .. here are some usage examples: metafile ./path/2/file the constant is that they provide filepath(s).. so I feel silly asking them to turn the above examples to.. metafile ./path/2/file In reply to Why is it good practice for a cli script to take switch args before file list? by leocharre
|
|