alphapapa / alphapapa/with-emacs.sh

Does not work with default Mac `getopt` version

Offen
#3 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
documentation help wanted
Vorherrschende Sprache
Shell
Sterne
174
Forks
16
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

The Mac `getopt` is unable to parse long options and uses a slightly different syntax. I need to test this on a linux box, but I believe the following change will be sufficient.

```
getopt -T > /dev/null
if [ $? -eq 4 ]; then
# GNU enhanced getopt available with long options
args=$(getopt -n "$0" -o d:hi:OPR -l dir:,debug,help,install:,no-package,no-org-repo,no-refresh-packages -- "$@") || { usage; exit 1; }

else
# Mac/BSD version
args=$(getopt d:hi:OPR "$*")
fi
eval set -- "$args"
```

I did need to change the `while [true]` to `while [ $# -gt 0 ];` at the top of the argument processing loop as well. I did have some trouble passing on arguments to emacs in the `$rest` variable, but it does let me quickly setup a sandbox.

Of course the other option is to just install `getopt` from homebrew, and this would all be moot :)

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.