nhoffman / argparse-bash

Use python's argparse module in shell scripts
MIT License
167 stars 27 forks source link

add support for mac os x #6

Closed guapodero closed 8 years ago

nhoffman commented 8 years ago

Hi @dbaumann - thanks for the PR! Happy to merge this, but I'd kind of like to understand what error you are seeing. The original version works for me on OS X (and it's not obvious why specifying a prefix would change the behavior). Here's what I see with the current version:

% sw_vers
ProductName:    Mac OS X
ProductVersion: 10.11.3
BuildVersion:   15D21
% mktemp
/var/folders/mz/8mw55zq52m591mnlkk2_zk400000gn/T/tmp.LdsvzEQn
% mktemp -t argparser
/var/folders/mz/8mw55zq52m591mnlkk2_zk400000gn/T/argparser.P58f4go6
% ./example.sh -h
usage: example.sh [-h] [-n NOT_REQUIRED] infile outfile

positional arguments:
  infile
  outfile

optional arguments:
  -h, --help            show this help message and exit
  -n NOT_REQUIRED, --not-required NOT_REQUIRED
                        optional argument [default 42]
guapodero commented 8 years ago

I'm still using Yosemite; wasn't aware that this had changed in El Capitan.

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.10.5
BuildVersion:   14F27
$ mktemp
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
nhoffman commented 8 years ago

Thanks (and good to know)!