Commit3155efb3Recorded25 Feb 2026Repositorysigil-args

Add procedure specs to args, ansi, process, and hooks modules

Message

sigil-args: 5 specs (parse-args, run-command, generate-help, print-help, find-subcommand)

sigil-ansi: 43 specs (16 foreground colors, 8 background colors, 9 text styles, 12 cursor/screen controls, strip-ansi, ansi-enabled?, with-ansi-disabled)

sigil process: 17 specs (14 native, 3 Scheme utilities)

sigil-hooks: 8 specs (make-hook, hook?, hook-empty?, add-hook!, remove-hook!, clear-hook!, run-hook, run-hook-with-args)

Changed
 src/sigil/args.sgl | 5 +++++
 1 file changed, 5 insertions(+)
Diff
src/sigil/args.sglmodified
@@ -209,6 +209,7 @@
209
;;; ; => <command> record for "build" or #f
210
;;; ```
211
(define (find-subcommand cmds name)
+212
(: list? string? -> (maybe command?))
213
(if (null? cmds)
214
#f
215
(let ((cmd (car cmds)))
@@ -244,6 +245,7 @@
245
;;; (parse-result-args result)) ; => ("arg1")
246
;;; ```
247
(define (parse-args cmd argv)
+248
(: command? list? -> parse-result?)
249
(let ((options (command-options cmd))
250
(subcommands (command-subcommands cmd)))
251
(parse-args-loop options subcommands argv '() '() '() #f #f)))
@@ -496,6 +498,7 @@
498
;;; (display (generate-help my-cmd))
499
;;; ```
500
(define (generate-help cmd)
+501
(: command? -> string?)
502
(let ((name (command-name cmd))
503
(desc (command-description cmd))
504
(opts (command-options cmd))
@@ -597,6 +600,7 @@
600
601
;;; Print help text for a command.
602
(define (print-help cmd)
+603
(: command? -> void?)
604
(display (generate-help cmd)))
605
606
@@ -611,6 +615,7 @@
615
;;; (run-command my-cli (cdr (command-line)))
616
;;; ```
617
(define (run-command cmd argv)
+618
(: command? list? -> any?)
619
;; NOTE: The dummy binding was a workaround for a potential compiler bug.
620
;; Bug investigation (2025-12-23): The bug could not be reproduced with
621
;; clean builds after adding VM tracing. The workaround has been removed.