Refactor command-name
This commit is contained in:
parent
c05db1ecf4
commit
d305ceffe1
|
@ -10,24 +10,25 @@
|
||||||
|
|
||||||
(define-values (program+command-name)
|
(define-values (program+command-name)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let-values ([(p) (find-system-path 'run-file)]
|
(define-values (p) (find-system-path 'run-file))
|
||||||
[(n) (current-command-name)])
|
(define-values (n) (current-command-name))
|
||||||
(if n
|
(if n (format "~a ~a" p n) p)))
|
||||||
(format "~a ~a" p n)
|
|
||||||
p))))
|
|
||||||
|
|
||||||
(define-values (short-program+command-name)
|
(define-values (short-program+command-name)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let-values ([(p) (find-system-path 'run-file)]
|
(define-values (p) (find-system-path 'run-file))
|
||||||
[(n) (current-command-name)])
|
(define-values (n) (current-command-name))
|
||||||
(let-values ([(base name dir?) (split-path p)])
|
(define-values (base name dir?) (split-path p))
|
||||||
(let-values ([(name) (if (eq? (system-type) 'windows)
|
(define-values (converted-name) (convert-name name))
|
||||||
|
(if n
|
||||||
|
(format "~a ~a" converted-name n)
|
||||||
|
(path->string converted-name))))
|
||||||
|
|
||||||
|
(define-values (convert-name)
|
||||||
|
(lambda (name)
|
||||||
|
(if (eq? (system-type) 'windows)
|
||||||
(string->path-element
|
(string->path-element
|
||||||
(regexp-replace #rx"(?i:[.]exe)$"
|
(regexp-replace #rx"(?i:[.]exe)$"
|
||||||
(path-element->string name)
|
(path-element->string name)
|
||||||
""))
|
""))
|
||||||
name)])
|
name))))
|
||||||
(if n
|
|
||||||
(format "~a ~a" name n)
|
|
||||||
(path->string name))))))))
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user