matejak / argbash

Bash argument parsing code generator
Other
1.4k stars 62 forks source link

macOS: readlink: illegal option -- e #74

Closed rliljest closed 5 years ago

rliljest commented 5 years ago

The version of readlink installed on macOS does not support the -e flag, so there's a lot of noise when running argbash commands. Most of the time this noise is just when using argbash on a script, but it can happen in the generated script too when the ARG_USE_PROG template is used.

% argbash -o output.sh simple.sh
readlink: illegal option -- e
usage: readlink [-n] [file ...]
/usr/local/bin/argbash: line 450: -2: substring expression < 0
readlink: illegal option -- e
usage: readlink [-n] [file ...]
The --library option is deprecated, use --strip user-content next time
The output can't be blank - it is not a legal filename!

On a mac you can install a version of readlink that argbash expects: Using homebrew, brew install coreutils will install greadlink which supports the -e flag.

So one potential solution would be for argbash itself to use ARG_USE_PROG to allow us to specify readlink exe to use, and on a mac setting that to greadlink would remove the noise

gdevenyi commented 5 years ago

Alternatively: https://gist.github.com/esycat/5279354

matejak commented 5 years ago

This whole readlink thing is a pain. I am thinking of turning it off by default.