ncbi / gaptools

dbGaP data validation tool repo
Other
11 stars 11 forks source link

Need gnu getopt on Macs #14

Open DanielEWeeks opened 1 year ago

DanielEWeeks commented 1 year ago

Might be helpful to point out in your Readme that on a Mac, it will be necessary to switch to using gnu getopt instead of the default getopt in order for your dbgap-docker.bash script to run. This can be done by issuing these commands:

brew install gnu-getopt 
brew link --force gnu-getopt

With the default version of getopt that comes with the Macs, the dbgap-docker.bash example commands dies with this rather cryptic error message:

$ ./dbgap-docker.bash -i ./input_files/1000_Genomes_Study/ -o ./output_files/1000_Genomes_Study -m ./input_files/1000_Genomes_Study/metadata.json up
getopt: illegal option -- l
getopt: illegal option -- g
getopt: illegal option -- e
getopt: illegal option -- l
getopt: illegal option -- ,
getopt: illegal option -- u
getopt: illegal option -- :
getopt: illegal option -- ,
getopt: illegal option -- u
getopt: illegal option -- u
getopt: illegal option -- :
getopt: illegal option -- ,
getopt: illegal option -- a
Wrong number/type of arguments
Usage: dbgap-docker.bash [-h] [-i, --input [input directory]]
[-o, --output [output directory]] 
[-m, --manifest [manifest file]]
[up|down]
alanhoyle commented 1 year ago

The above pull request #19 provides a work-around by detecting macOS and forcing the script to only attempt to use the short options supported by BSD's getopt.