mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
Merge pull request #729 from lassik/srfi-193
Add SRFI 193 Scheme library
This commit is contained in:
commit
de02feb8ff
1 changed files with 23 additions and 0 deletions
23
lib/srfi/193.sld
Normal file
23
lib/srfi/193.sld
Normal file
|
@ -0,0 +1,23 @@
|
|||
|
||||
(define-library (srfi 193)
|
||||
(export command-line command-name command-args script-file script-directory)
|
||||
(import (scheme base) (chibi filesystem) (chibi pathname)
|
||||
(only (meta) command-line raw-script-file))
|
||||
(begin
|
||||
|
||||
(define (command-name)
|
||||
(let ((filename (car (command-line))))
|
||||
(and (not (= 0 (string-length filename)))
|
||||
(path-strip-extension (path-strip-directory filename)))))
|
||||
|
||||
(define (command-args)
|
||||
(cdr (command-line)))
|
||||
|
||||
(define (script-file)
|
||||
(and raw-script-file
|
||||
(path-normalize
|
||||
(path-resolve raw-script-file (current-directory)))))
|
||||
|
||||
(define (script-directory)
|
||||
(let ((filename (script-file)))
|
||||
(and filename (string-append (path-directory filename) "/"))))))
|
Loading…
Add table
Reference in a new issue