<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title>there was a fish in the calculator</title><id>https://fishinthecalculator.me/feeds/tags/parsing.xml</id><subtitle>Tag: parsing</subtitle><updated>2026-05-05T22:13:01Z</updated><link href="https://fishinthecalculator.me/feeds/tags/parsing.xml" rel="self" /><link href="https://fishinthecalculator.me" /><entry><title>Arguments parsing in Guile</title><id>https://fishinthecalculator.me/blog/arguments-parsing-in-guile.html</id><author><name>Giacomo Leidi</name><email>therewasa@fishinthecalculator.me</email></author><updated>2026-05-05T23:50:00Z</updated><link href="https://fishinthecalculator.me/blog/arguments-parsing-in-guile.html" rel="alternate" /><content type="html">&lt;p&gt;While Guile Scheme has a lot of hidden gems, like &lt;code&gt;(ice-9 peg)&lt;/code&gt;, parsing command line arguments is not one of its strengths in my opinion. Even if there are many powerful approaches to structured argument parsing, there is no API simple enough for me to know it by heart (as opposed for example to Python &lt;code&gt;ArgumentParser&lt;/code&gt;).&lt;/p&gt;&lt;p&gt;In this post, I will analyze some of what I believe to be shortcomings of existing command line arguments parsing libraries and present my proposal for a new iteration with a new, small, API for parsing arguments in Guile. It is small enough to fit in my brain, so I think we may be onto something here.&lt;/p&gt;&lt;h3 id=&quot;on_llms&quot;&gt;On LLMs&lt;/h3&gt;&lt;p&gt;The first commit of my library has been partially created with the help of a large language model.  The commit message contains the attribution information and the prompt I used.  I am aware that currently LLM provider companies are actively harming people and the environment, enabling racial profiling and supporting governments in making wars against international laws.  Nevertheless, I tried one of the commercial LLMs to test its capabilities from a technological standpoint.  In general, I believe that there is an ethical way of training and operating LLMs, one that respects content creators, users, workers and the environment. This post is not about LLMs, but if you have any comment or feedback for me, feel free to reach out either on the Fediverse or via email.&lt;/p&gt;&lt;h2 id=&quot;(ice-9_getopt-long)&quot;&gt;(ice-9 getopt-long)&lt;/h2&gt;&lt;p&gt;The &lt;code&gt;(ice-9 getopt-long)&lt;/code&gt; module is the first API we'll take into consideration, it is modelled after the C library of the same name. According to &lt;code&gt;git log&lt;/code&gt;, it is the oldest command line parsing API around, it was added to Guile in 1999!&lt;/p&gt;&lt;pre&gt;&lt;code&gt;commit 4925695e21f9150632c4173a7814ce78aacd80bc
Author: Jim Blandy &amp;lt;jimb@red-bean.com&amp;gt;
Date:   Fri Feb 12 10:09:29 1999 +0000

* getopt-long.scm: Remove debugging calls to `pk'.
A new argument-processing package from Russ McManus.
* getopt-long.scm: New file.
* Makefile.am (ice9_sources): Added getopt-long.scm.
* Makefile.in: Regenerated.&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Its designed around the idea that it should only take care of short (&lt;code&gt;-s&lt;/code&gt;) and long (&lt;code&gt;--long&lt;/code&gt;) options, leaving the parsing of positional arguments (optionally delimited by &lt;code&gt;--&lt;/code&gt;) to the caller. One would define an option specification:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;option-spec&lt;/span&gt;
  &lt;span class=&quot;syntax-symbol&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;help&lt;/span&gt;
     &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;single-char&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#\h&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;syntax-comment&quot;&gt;;; --help does not accept a value
&lt;/span&gt;     &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#f&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;shout&lt;/span&gt;
     &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;single-char&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#\s&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;syntax-comment&quot;&gt;;; --shout does not accept a value
&lt;/span&gt;     &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#f&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;language&lt;/span&gt;
     &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;single-char&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#\l&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;syntax-comment&quot;&gt;;; --shout accepts a value
&lt;/span&gt;     &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#t&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This code defines three options:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;-h&lt;/code&gt;/&lt;code&gt;--help&lt;/code&gt; which is intended to print an help message&lt;/li&gt;&lt;li&gt;&lt;code&gt;-s&lt;/code&gt;/&lt;code&gt;--shout&lt;/code&gt; and &lt;code&gt;-l&lt;/code&gt;/&lt;code&gt;--language&lt;/code&gt; which are business logic related flags&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;code&gt;getopt-long&lt;/code&gt; accepts short and long forms interchangeably, without making distinction. An example is that &lt;code&gt;greet.scm --language it --shout hajar&lt;/code&gt;, &lt;code&gt;greet.scm --language en -s hajar&lt;/code&gt; and &lt;code&gt;greet.scm -sl it hajar&lt;/code&gt; have all the same meaning.&lt;/p&gt;&lt;p&gt;Notice that this specification contains a &lt;code&gt;-h&lt;/code&gt; flag, but &lt;code&gt;getopt-long&lt;/code&gt; does not handle that by default as some similar APIs do. You are the one that should detect that the &lt;code&gt;'help&lt;/code&gt; option has been passed and emit the help message yourself:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;syntax-comment&quot;&gt;;; Help message
&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;show-help&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Usage: greet.scm [OPTIONS] NAME

Say hello to someone\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Positional arguments:&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;  NAME&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Options:&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;
  -h, --help             Show this help message and exit&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt;  &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;
  -s, --shout&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;
  -l, --language LEVEL    (default: en)&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-comment&quot;&gt;;; Parse command line into a structured object
&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;getopt-long&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;command-line&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;option-spec&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-comment&quot;&gt;;; Use the parsed arguments
&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;language&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;option-ref&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'language&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;en&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;shout?&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;option-ref&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'shout&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#f&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;syntax-comment&quot;&gt;;; Handle user passing --help
&lt;/span&gt;       &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;help&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;option-ref&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'help&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#f&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
               &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;show-help&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
               &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;syntax-comment&quot;&gt;;; Obtain positional arguments list
&lt;/span&gt;       &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;positional-args&lt;/span&gt;
        &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;first&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;positional-args&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                     &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;null?&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;positional-args&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;NAME argument is required but none was passed&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;first&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;positional-args&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;msg&lt;/span&gt;
        &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string-append&lt;/span&gt;
         &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string?&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;language&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string=?&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;language&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;it&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;ciao, &amp;quot;&lt;/span&gt;
             &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;hello, &amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;shout?&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string-upcase&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&quot;a_note_on_argument_parsing&quot;&gt;A note on argument parsing&lt;/h4&gt;&lt;blockquote&gt;&lt;p&gt;As you will notice later, all the examined libraries and the one I wrote follow the same general algorithm:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Declare some kind of structured specification&lt;/li&gt;&lt;li&gt;Derive some parsing rules from the specification&lt;/li&gt;&lt;li&gt;Apply the parsing to a list of command line arguments&lt;/li&gt;&lt;li&gt;Provide the user with some key of key-value data structure&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;In the above example point &lt;code&gt;1.&lt;/code&gt; is the &lt;code&gt;option-spec&lt;/code&gt; declaration, points &lt;code&gt;2.&lt;/code&gt; and &lt;code&gt;3.&lt;/code&gt; happen inside &lt;code&gt;getopt-long&lt;/code&gt; and point &lt;code&gt;4.&lt;/code&gt; happens in the last &lt;code&gt;let&lt;/code&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;With the above code we can run a simple greeter with a basic command line interface with:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;$ guile -s greet-getopt-long.scm -s --language it hajar
CIAO, HAJAR
$ guile -s greet-getopt-long.scm -h

Usage: greet-getopt-long.scm [OPTIONS] NAME

Say hello to someone.

Positional arguments:
  NAME

Options:
  -h, --help               Show this help message and exit
  -s, --shout
  -l, --language LANGUAGE   (default: en)&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In case you are interested you can also &lt;a href=&quot;/static/code/greet-getopt-long.scm&quot;&gt;have a look at the complete code&lt;/a&gt; for the &lt;code&gt;getopt-long&lt;/code&gt; example.&lt;/p&gt;&lt;p&gt;In general &lt;code&gt;(ice-9 getopt-long)&lt;/code&gt; is a solid and battle tested API. In case having additional dependencies outside of the Guile runtime is not acceptable I think it is still a nice option to have, but it's API could make it easier to use.&lt;/p&gt;&lt;p&gt;Default values are specified at &lt;code&gt;option-ref&lt;/code&gt; call site, this means that if you read an option with a default value in multiple places you might remember to set the default value in one. Additionally the option specification format (albeit powerful, as it allows more features than I show above, &lt;a href=&quot;https://www.gnu.org/software/guile/manual/html_node/Option-Specification.html&quot;&gt;like type validation and more&lt;/a&gt;) is not easy to remember (at least for me) and it does not allow describing positional arguments.&lt;/p&gt;&lt;p&gt;One last detail is the need for users to handle &lt;code&gt;--help&lt;/code&gt; by themselves. It's good to be able to opt in in that fine grained control but most simple scripts that just want to accept some values (I think of the output of many &lt;code&gt;program-file&lt;/code&gt; gexps all over Guix) are usually fine with the library generating the help message and handling scenarios when the user passes &lt;code&gt;-h&lt;/code&gt; or &lt;code&gt;--help&lt;/code&gt;.&lt;/p&gt;&lt;h2 id=&quot;(srfi_srfi-37)&quot;&gt;(srfi srfi-37)&lt;/h2&gt;&lt;p&gt;&lt;code&gt;(srfi srfi-37)&lt;/code&gt; is the second oldest Guile API for parsing command line arguments, it was first added to Guile in 2007:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;commit d4c382218de2050de207318e9d8558c0aac6a7b9
Author: Ludovic Courtès &amp;lt;ludo@gnu.org&amp;gt;
Date:   Wed Jul 18 20:40:09 2007 +0000

Revision: lcourtes@laas.fr--2006-libre/guile-core--cvs-head--0--patch-81
Creator:  Ludovic Courtes &amp;lt;ludovic.courtes@laas.fr&amp;gt;

Added SRFI-37, by Stephen Compall.

(See ChangeLogs.)&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It is similar to &lt;code&gt;(ice-9 getopt-long)&lt;/code&gt; in spirit: positional arguments are left up to the user to be parsed, help messages must be manually crafted and the user must manually handle &lt;code&gt;--help&lt;/code&gt; (even if it's easier than with &lt;code&gt;(ice-9 getopt-long)&lt;/code&gt;) and options are declared in a specification.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;syntax-comment&quot;&gt;;; Options specification
&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;%options&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;option&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;#\s&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;shout&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#f&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#f&lt;/span&gt;               &lt;span class=&quot;syntax-comment&quot;&gt;;(short long) mandatory? optional?
&lt;/span&gt;                &lt;span class=&quot;syntax-comment&quot;&gt;;; Here the API is leaking,
&lt;/span&gt;                &lt;span class=&quot;syntax-comment&quot;&gt;;; the end result is simply to
&lt;/span&gt;                &lt;span class=&quot;syntax-comment&quot;&gt;;; set 'shout? to #t
&lt;/span&gt;                &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;opt&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;alist-cons&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'shout?&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#t&lt;/span&gt;
                              &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;alist-delete&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'shout?&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;option&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;#\h&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;help&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#f&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#f&lt;/span&gt;
                &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;args&lt;/span&gt;
                  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;show-help&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;option&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;#\l&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;language&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#t&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#f&lt;/span&gt;
                &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;opt&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;alist-cons&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'language&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;arg&lt;/span&gt;
                              &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;alist-delete&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'language&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;%default-options&lt;/span&gt;
  &lt;span class=&quot;syntax-comment&quot;&gt;;; Alist of default option values.
&lt;/span&gt;  &lt;span class=&quot;syntax-symbol&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;shout?&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#f&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;language&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;en&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
    
&lt;span class=&quot;syntax-comment&quot;&gt;;; Display help message
&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;show-help&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Usage: greet.scm [OPTIONS] NAME

Say hello to someone\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Positional arguments:&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;  NAME&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Options:&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;
  -h, --help             Show this help message and exit&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt;  &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;
  -s, --shout&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;
  -l, --language LEVEL    (default: en)&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;But still, there are some differences. &lt;code&gt;(srfi srfi-37)&lt;/code&gt; makes it easier to handle &lt;code&gt;--help&lt;/code&gt; with its callback approach in the specification, but the in general API is leaking, forcing the user to manually manipulate options with &lt;code&gt;alist-cons&lt;/code&gt; and &lt;code&gt;alist-delete&lt;/code&gt;. Any user error here will weirdly break programs without users not easily noticing.&lt;/p&gt;&lt;p&gt;The second difference of &lt;code&gt;(srfi srfi-37)&lt;/code&gt; is &lt;code&gt;args-fold&lt;/code&gt;. It is called instead of calling &lt;code&gt;getopt-long&lt;/code&gt;, it returns an association list mapping option names to option values. This format has the nice property of being easily introspectable and easy to change programmatically.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;options&lt;/span&gt;
  &lt;span class=&quot;syntax-comment&quot;&gt;;; Derive parsing rules from the options specification,
&lt;/span&gt;  &lt;span class=&quot;syntax-comment&quot;&gt;;; and parse the command line into an association list.
&lt;/span&gt;  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;args-fold&lt;/span&gt;
   &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;command-line&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;syntax-symbol&quot;&gt;%options&lt;/span&gt;
   &lt;span class=&quot;syntax-comment&quot;&gt;;; Called in case of an unrecognized option
&lt;/span&gt;   &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;opt&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;~A: unrecognized option~%&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;syntax-comment&quot;&gt;;; Accumulation procedure for positional arguments
&lt;/span&gt;   &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;alist-cons&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'argument&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;syntax-comment&quot;&gt;;; Start seed
&lt;/span&gt;   &lt;span class=&quot;syntax-symbol&quot;&gt;%default-options&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;language&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;assoc-ref&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'language&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;shout?&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;assoc-ref&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'shout?&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;assoc-ref&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'argument&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;msg&lt;/span&gt;
        &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;NAME argument is required but none was passed&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string-append&lt;/span&gt;
             &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string?&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;language&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string=?&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;language&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;it&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;ciao, &amp;quot;&lt;/span&gt;
                 &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;hello, &amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;shout?&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string-upcase&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This script is completely equivalent to the example for &lt;code&gt;(ice-9 getopt-long)&lt;/code&gt;, &lt;a href=&quot;/static/code/greet-srfi37.scm&quot;&gt;check out its complete code&lt;/a&gt; in case you are interested.&lt;/p&gt;&lt;p&gt;&lt;code&gt;(srfi srfi-37)&lt;/code&gt; is sligthly easier to use than &lt;code&gt;(ice-9 getopt-long)&lt;/code&gt;, but the option specification format is even more difficult to remember. I am almost unable to write or modify an option specification without having the Guile manual open. &lt;code&gt;args-fold&lt;/code&gt; is super cool, it just misses support for parsing positional arguments to be perfect.&lt;/p&gt;&lt;h2 id=&quot;guile-config&quot;&gt;guile-config&lt;/h2&gt;&lt;p&gt;This is probably the most complex tool in the list and definitely the one with a broader scope. It has been my default up until now, as it is very handy and follows a batteries included approach. &lt;a href=&quot;https://gitlab.com/a-sassmannshausen/guile-config&quot;&gt;guile-config&lt;/a&gt; is a library to declare application configurations specifications that are used to derive command line interfaces and configuration files. It does a lot of stuff, I really invite you to check it out as in my opinion for medium sized projects is perfect. My dream is that the portion of &lt;code&gt;guile-config&lt;/code&gt;'s code that overlaps with &lt;code&gt;(guix records)&lt;/code&gt; would be abstracted from both projects into a common dependency, but this is another story and we will tell it another time.&lt;/p&gt;&lt;p&gt;In &lt;code&gt;guile-config&lt;/code&gt;, users declare the configuration of an application with a &lt;code&gt;configuration&lt;/code&gt; record:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;use-modules&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;%configuration&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;configuration&lt;/span&gt;
   &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'greet-config&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;synopsis&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;The configuration of greet-config.&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;keywords&lt;/span&gt;
    &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;list&lt;/span&gt;
     &lt;span class=&quot;syntax-comment&quot;&gt;;; Command line options or
&lt;/span&gt;     &lt;span class=&quot;syntax-comment&quot;&gt;;; configuration file fields
&lt;/span&gt;     &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;switch&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'language&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;character&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#\l&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;en&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;test&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;string?&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;handler&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;identity&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;example&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;it&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;synopsis&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Language to use.&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;description&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;The language to use for the output.&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;switch&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'shout?&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;character&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#\s&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#f&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;test&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;boolean?&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;handler&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;identity&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;synopsis&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Enable shouting mode&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;description&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Whether to enable shouting mode.&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;syntax-comment&quot;&gt;;; Positional arguments
&lt;/span&gt;   &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;arguments&lt;/span&gt;
    &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;list&lt;/span&gt;
     &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;argument&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'name&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;test&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;string?&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;handler&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;identity&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;example&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Hajar&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;synopsis&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Name of a friend&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;description&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;The name of the friend you want to greet.&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;parser&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;sexp-parser&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;copyright&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Giacomo Leidi &amp;lt;therewasa@fishinthecalculator.me&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;version&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;0.1.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;license&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;GPL3+&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;author&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Giacomo Leidi&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This record contains all informations to derive command line option names, types and help messages. This allows guile-config to perform validation and help message generation on behalf of the user.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;syntax-comment&quot;&gt;;; Parse options and in case -h/--help is detected
&lt;/span&gt;&lt;span class=&quot;syntax-comment&quot;&gt;;; generate the help message, display it and exit
&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;getopt-config-auto&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;command-line&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;%configuration&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-comment&quot;&gt;;; Access configuration values
&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;language&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;option-ref&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'language&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;shout?&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;option-ref&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'shout?&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;option-ref&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;msg&lt;/span&gt;
        &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string-append&lt;/span&gt;
         &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string?&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;language&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string=?&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;language&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;it&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;ciao, &amp;quot;&lt;/span&gt;
             &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;hello, &amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;shout?&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string-upcase&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here is the &lt;a href=&quot;/static/code/greet-config.scm&quot;&gt;complete code for the above script&lt;/a&gt;. It is exactly what I need, were it not for the focus on configuration files also, as you can notice from the &lt;code&gt;(parser sexp-parser)&lt;/code&gt; line of the configuration specification. This is a specification for something that can be parsed from a file, not a specification of a simple command line interface.&lt;/p&gt;&lt;p&gt;In many cases people just want to write small scripts calling each other and having a structured command line interface that performs validation and is easy to write. My hope with &lt;code&gt;guile-arguments&lt;/code&gt; is to create exactly that.&lt;/p&gt;&lt;h2 id=&quot;guile-arguments&quot;&gt;guile-arguments&lt;/h2&gt;&lt;p&gt;&lt;code&gt;(arguments)&lt;/code&gt; was born due to an itch I often get while writing Guile scripts. In case they are very simple I always resort to calling &lt;code&gt;(first (command-line))&lt;/code&gt;, &lt;code&gt;(second (command-line))&lt;/code&gt; and so on, because I am never able to remember any of the above API by heart. In some case where I really needed a structured command line API I even resorted to Python. No parentheses, can you imagine?&lt;/p&gt;&lt;p&gt;&lt;code&gt;(arguments)&lt;/code&gt; API is really small and hopefully easy to remember. Users first have to declare a parser specification, which defines all the options the command will have:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;use-modules&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;arguments&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-comment&quot;&gt;;; We declare a structured specification of the
&lt;/span&gt;&lt;span class=&quot;syntax-comment&quot;&gt;;; command line API
&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;parser&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;argument-parser&lt;/span&gt;
    &lt;span class=&quot;syntax-keyword&quot;&gt;#:program&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;greet&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;syntax-keyword&quot;&gt;#:description&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Say hello to someone.&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;syntax-comment&quot;&gt;;; Flags are boolean toggles, #f by default
&lt;/span&gt;    &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;flag&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'shout?&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;short&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#\s&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;help&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Shout instead of speaking&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;syntax-comment&quot;&gt;;; Options are arguments that take a value,
&lt;/span&gt;    &lt;span class=&quot;syntax-comment&quot;&gt;;; if multiple? is #t they can be passed multiple
&lt;/span&gt;    &lt;span class=&quot;syntax-comment&quot;&gt;;; times to represent lists
&lt;/span&gt;    &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;option&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'language&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;short&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#\l&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;en&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;help&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Language code&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;syntax-comment&quot;&gt;;; Positional arguments are arguments referenced
&lt;/span&gt;    &lt;span class=&quot;syntax-comment&quot;&gt;;; by position. They also can be multiple? but
&lt;/span&gt;    &lt;span class=&quot;syntax-comment&quot;&gt;;; only one of them can and it must be the last
&lt;/span&gt;    &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;positional&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'name&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;help&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;Name of the friend to greet&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Next users must call &lt;code&gt;parse-arguments&lt;/code&gt; to get back a structured object representing the command line:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;syntax-comment&quot;&gt;;; Parse command line. parse-arguments parses (cdr (command-line)) by default,
&lt;/span&gt;&lt;span class=&quot;syntax-comment&quot;&gt;;; but in case you want to pass the command line yourself you can pass it
&lt;/span&gt;&lt;span class=&quot;syntax-comment&quot;&gt;;; as the last argument: (parse-arguments parser your-command-line)
&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;arguments&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;parse-arguments&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;parser&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-comment&quot;&gt;;; Unpack arguments and use them
&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;match-arguments&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;arguments&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;shout?&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;language&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;msg&lt;/span&gt;
         &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string-append&lt;/span&gt;
          &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string=?&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;language&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;it&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;ciao, &amp;quot;&lt;/span&gt;
              &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;hello, &amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;syntax-symbol&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;shout?&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string-upcase&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;newline&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this example we use &lt;code&gt;match-arguments&lt;/code&gt; which is syntax sugar around the &lt;code&gt;arguments-ref&lt;/code&gt; primitive to destructure arguments values out of the return value of &lt;code&gt;parse-arguments&lt;/code&gt;. In case users only want to access a single argument value they can call &lt;code&gt;(arguments-ref 'name-of-the-argument)&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;There is not much more, the above would already be equivalent to the earlier examples:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;guix&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;shell&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;guile&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;guix.scm&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;guile&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;-s&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;examples/greet.scm&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;-h&lt;/span&gt;
&lt;span class=&quot;syntax-symbol&quot;&gt;Usage:&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;greet&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;OPTIONS&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;NAME&lt;/span&gt;

&lt;span class=&quot;syntax-symbol&quot;&gt;Say&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;hello&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;someone.&lt;/span&gt;

&lt;span class=&quot;syntax-symbol&quot;&gt;Positional&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;arguments:&lt;/span&gt;
  &lt;span class=&quot;syntax-symbol&quot;&gt;NAME&lt;/span&gt;              &lt;span class=&quot;syntax-symbol&quot;&gt;Name&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;friend&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;greet&lt;/span&gt;

&lt;span class=&quot;syntax-symbol&quot;&gt;Options:&lt;/span&gt;
  &lt;span class=&quot;syntax-symbol&quot;&gt;-h,&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;--help&lt;/span&gt;               &lt;span class=&quot;syntax-symbol&quot;&gt;Show&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;help&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;syntax-special&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;exit&lt;/span&gt;
  &lt;span class=&quot;syntax-symbol&quot;&gt;-s,&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;--shout&lt;/span&gt;              &lt;span class=&quot;syntax-symbol&quot;&gt;Shout&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;instead&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;speaking&lt;/span&gt;
  &lt;span class=&quot;syntax-symbol&quot;&gt;-l,&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;--language&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;LANGUAGE&lt;/span&gt;  &lt;span class=&quot;syntax-symbol&quot;&gt;Language&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;code&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;default:&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;en&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;(arguments)&lt;/code&gt; intercepts &lt;code&gt;-h&lt;/code&gt; and &lt;code&gt;--help&lt;/code&gt; and automatically emits help messages and exits by default, but by passing &lt;code&gt;#:auto-help? #f&lt;/code&gt; users can turn off that behavior and handle the help request themselves.&lt;/p&gt;&lt;p&gt;In case you are interested you can have a look at the code of the &lt;code&gt;(arguments)&lt;/code&gt; greeter and test if from the &lt;a href=&quot;https://codeberg.org/fishinthecalculator/arguments/src/branch/main/examples/greet.scm&quot;&gt;Codeberg repository&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;You can get &lt;code&gt;guile-arguments&lt;/code&gt; from Guix or soon from openSUSE Tumbleweed. In case you want to play around with the code, you can find it on &lt;a href=&quot;https://codeberg.org/fishinthecalculator/arguments&quot;&gt;Codeberg&lt;/a&gt;.&lt;/p&gt;&lt;h3 id=&quot;next_steps&quot;&gt;Next steps&lt;/h3&gt;&lt;p&gt;&lt;code&gt;(arguments)&lt;/code&gt; is currently good enough for 80% of my personal use cases. What it currently misses is: first, the ability to structurally declare subcommands and subparsers, probably they can be made to work even with the current API but it'd be hacky, second, internationalization or the ability to handle different output languages such as in auto generated help messages but also in error messages. I really hope it can be of help also to others.&lt;/p&gt;&lt;p&gt;In case you are interested to chat about &lt;code&gt;(arguments)&lt;/code&gt;, or have any kind of feedback, reach out via email or on the Fediverse!&lt;/p&gt;</content></entry></feed>