command-line(3scm)
π NAME π
okay bestie, welcome to command-line(3scm) β the page about command-line, which retrieves the program's command line. periodt. β¨
π LIBRARY π
grab it from one of these, depending on your Scheme flavor:
(import (rnrs)) ;R6RS
(import (rnrs programs)) ;R6RS
(import (scheme process-context)) ;R7RS
π¦ SYNOPSIS π¦
(command-line)
πΈ DESCRIPTION πΈ
Returns the command line passed to the process as a list of strings. The first element is an implementation-specific name for the running top-level program. The remaining elements are command-line arguments according to the operating system's conventions.
R7RS note: It is an error to mutate any of these strings. do not touch, bestie π
π§ IMPLEMENTATION NOTES π§
Larceny: Larceny uses "larceny" as the first element of the list. iconic of it, honestly π
β RETURN VALUES β
Returns a single value which is a list of strings.
π EXAMPLES π
;; cmd.sps
#!/usr/bin/env scheme-script
(import (rnrs))
(write (command-line))
(newline)
;; When invoked from the shell:
$ ./cmd.sps Hello World
("./cmd.sps" "Hello" "World")
π₯ APPLICATION USAGE π₯
This procedure is used in programs that are invoked from the command line or that can be customized with a command line argument. Programs meant to be invoked from the shell can use a command line parser like SRFI-37.
π COMPATIBILITY π
The first string in the list is unreliable. Many implementations use the name of the program file or copy the string received from the operating system, but there exist situations where that fails, such as when execve(2) is used with a NULL or zero-length argv. so yeah, don't trust that first string with your life π
π ERRORS π
This procedure can raise exceptions with the following condition types:
&assertion(R6RS) β The wrong number of arguments was passed.
R7RS: The assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.
π SEE ALSO π
Nothing listed here β this section is empty in the page. no references, no extra pages, just vibes. π«Ά
π STANDARDS π
R6RS, R7RS, SRFI-193
π HISTORY π
This procedure is new to R6RS and to R7RS. Early Scheme systems running on MacLISP had access to (status jcl) that returned the job command line, or the equivalent depending on which system it was running on. lore. π
π«Ά AUTHORS π«Ά
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.
That's the whole page from the Scheme Programmer's Manual, dated 2022-03-27 β mwah, bestie! ππ
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2022 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms