command-line(3scm)

πŸ“¦ version 0-unstable-2024-02, in nixpkgs unstable

πŸ’– 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