1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-23 20:05:32 +02:00

Implement #:stop-at-first-non-option option for getopt-long

(For use by guile-tools)

* module/ice-9/getopt-long.scm: Use (ice-9 optargs) so we can use
  define*.

  (process-options): Add stop-at-first-non-option parameter.  When
  this is true, stop processing when we hit a non-option (so long as
  that non-option isn't something that resulted from the unclumping of
  a short option group).

  (getopt-long): Add #:stop-at-first-non-option keyword; pass it on to
  process-options.

* test-suite/tests/getopt-long.test ("stop-at-first-non-option"): New
  test (for the above).
This commit is contained in:
Neil Jerram 2011-05-08 22:21:51 +01:00
parent 0faf4b2a74
commit 6b4b4bfb09
2 changed files with 20 additions and 3 deletions

View file

@ -288,4 +288,15 @@
)
(with-test-prefix "stop-at-first-non-option"
(pass-if "guile-tools compile example"
(equal? (getopt-long '("guile-tools" "compile" "-Wformat" "eval.scm" "-o" "eval.go")
'((help (single-char #\h))
(version (single-char #\v)))
#:stop-at-first-non-option #t)
'((() "compile" "-Wformat" "eval.scm" "-o" "eval.go"))))
)
;;; getopt-long.test ends here