Deploying upstream@0835c6d8ae075228e93cbe4beb3cf722b5fff884: Fix Now link to point to starfort

This commit is contained in:
2026-05-21 08:49:21 -04:00
parent ef2b8bea43
commit 74e2a03567
74 changed files with 4104 additions and 832 deletions

View File

@@ -45,7 +45,7 @@
content="2026-01-19">
<meta
property="og:article:modified_time"
content="2026-01-19">
content="2026-05-21">
<meta
property="og:article:author"
content="Andrew Kesterson">
@@ -304,12 +304,12 @@
alt="author avatar">
<p class="author-name">Andrew Kesterson</p>
<p class="author-description"><center><i>"Love God. Live Righteously. Die Well."</i> <br/> <br/> <a target="_blank" rel="noopener" href="https://github.com/akesterson">GitHub</a> || <a target="_blank" rel="noopener" href="https://www.linkedin.com/in/andrewkesterson/">LinkedIn</a> <br/> </center></p>
<p class="author-description"><center><i>"Love God. Live Righteously. Die Well."</i> <br/> <br/> <a target="_blank" rel="noopener" href="https://source.starfort.tech/andrew">Source Code</a> || <a target="_blank" rel="noopener" href="https://www.linkedin.com/in/andrewkesterson/">LinkedIn</a> <br/> </center></p>
<div class="author-message">
<a
class="author-posts-count"
href="/archives">
<span>28</span>
<span>29</span>
<span>Posts</span>
</a>
<a
@@ -405,7 +405,7 @@
<a href="/categories/Technology/">
<div class="categories-list-item">
Technology
<span class="categories-list-item-badge">10</span>
<span class="categories-list-item-badge">11</span>
</div>
</a>
@@ -501,8 +501,8 @@
<li>You might need to accept multiple values for a given argument and build a list. How do you do this? Do you accept a string with space separated items? Do you accept the same argument over and over? How do you store this in your scripts internal state?</li>
</ul>
<p>I feel the same way about bash that I do about C: its basically the perfect language for its domain (in bashs case, gluing tasks together on a unix system). But this particular task in bash has always managed to really piss me off, because frankly, we can do so much better than what we are doing right now. This is one of the big reasons why people will abandon bash for the kinds of glue tasks its so good at, and move to something like <code>golang</code>, because theres not a great interface between the user and the script for configuring options at runtime. Parsing arguments can be downright unfriendly to the user, in fact, let alone to the developer. It doesnt have to be this way! Theres no reason why Java and Python and Ruby and Golang and <em>literally every other language out there</em> can have high quality argument parsing libraries but Bash cant have them.</p>
<p>So I wrote <a target="_blank" rel="noopener" href="https://github.com/akesterson/cmdarg">cmdarg</a>: A pure bash argument parsing library. This library solves all of the above problems you will suffer through in all of the above scenarios. Any time I need to add arguments to a bash script, I reach for this library, and I am always pleased with the result.</p>
<h2 id="Declarative-Syntax-for-Clear-Interfaces"><a href="#Declarative-Syntax-for-Clear-Interfaces" class="headerlink" title="Declarative Syntax for Clear Interfaces"></a>Declarative Syntax for Clear Interfaces</h2><p><a target="_blank" rel="noopener" href="https://github.com/akesteron/cmdarg">Cmdarg</a> wants to help you build a clear interface to your script without asking you to write any of the parsing code. You want to write your script - you dont want to write argument parsing code. So cmdarg allows you to <a target="_blank" rel="noopener" href="https://github.com/akesterson/cmdarg?tab=readme-ov-file#cmdarg-1">declare the interface</a>, <a target="_blank" rel="noopener" href="https://github.com/akesterson/cmdarg?tab=readme-ov-file#cmdarg_parse">parse the arguments</a>, and <a target="_blank" rel="noopener" href="https://github.com/akesterson/cmdarg?tab=readme-ov-file#tldr">get on with using the values in your script</a>. Cmdarg assumes your script will take 0 or more command line arguments, and each one of these arguments will have:</p>
<p>So I wrote <a target="_blank" rel="noopener" href="https://source.starfort.tech/andrew/cmdarg">cmdarg</a>: A pure bash argument parsing library. This library solves all of the above problems you will suffer through in all of the above scenarios. Any time I need to add arguments to a bash script, I reach for this library, and I am always pleased with the result.</p>
<h2 id="Declarative-Syntax-for-Clear-Interfaces"><a href="#Declarative-Syntax-for-Clear-Interfaces" class="headerlink" title="Declarative Syntax for Clear Interfaces"></a>Declarative Syntax for Clear Interfaces</h2><p><a target="_blank" rel="noopener" href="https://github.com/akesteron/cmdarg">Cmdarg</a> wants to help you build a clear interface to your script without asking you to write any of the parsing code. You want to write your script - you dont want to write argument parsing code. So cmdarg allows you to <a target="_blank" rel="noopener" href="https://source.starfort.tech/andrew/cmdarg#cmdarg-1">declare the interface</a>, <a target="_blank" rel="noopener" href="https://source.starfort.tech/andrew/cmdarg#cmdarg_parse">parse the arguments</a>, and <a target="_blank" rel="noopener" href="https://source.starfort.tech/andrew/cmdarg#tldr">get on with using the values in your script</a>. Cmdarg assumes your script will take 0 or more command line arguments, and each one of these arguments will have:</p>
<ul>
<li>A name</li>
<li>A type, including whether or not the argument is required or optional</li>
@@ -629,13 +629,13 @@ argv &#x3D;&gt;
3 &#x3D;&gt; -m
4 &#x3D;&gt; --some_thing<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h2 id="Theres-more-Go-read-the-README"><a href="#Theres-more-Go-read-the-README" class="headerlink" title="Theres more. Go read the README"></a>Theres more. Go read the README</h2><p>Im not going to repeat the entirety of the README here, so <a target="_blank" rel="noopener" href="https://github.com/akesterson/cmdarg/">go find out for yourself</a> about:</p>
<h2 id="Theres-more-Go-read-the-README"><a href="#Theres-more-Go-read-the-README" class="headerlink" title="Theres more. Go read the README"></a>Theres more. Go read the README</h2><p>Im not going to repeat the entirety of the README here, so <a target="_blank" rel="noopener" href="https://source.starfort.tech/andrew/cmdarg/">go find out for yourself</a> about:</p>
<ul>
<li>Using <a target="_blank" rel="noopener" href="https://github.com/akesterson/cmdarg?tab=readme-ov-file#validators">validator functions</a> to validate user input on the arguments (including key names on map options)</li>
<li>Using <a target="_blank" rel="noopener" href="https://github.com/akesterson/cmdarg?tab=readme-ov-file#helpers">helper functions</a> to control how arguments are described and how usage (<code>--help</code>) messages are constructed&#x2F;printed</li>
<li>Using <a target="_blank" rel="noopener" href="https://github.com/akesterson/cmdarg?tab=readme-ov-file#controlling-cmdargs-behavior-on-error">custom error handlers</a> to control what happens when the parser encounters an error in user input</li>
<li>Using <a target="_blank" rel="noopener" href="https://source.starfort.tech/andrew/cmdarg#validators">validator functions</a> to validate user input on the arguments (including key names on map options)</li>
<li>Using <a target="_blank" rel="noopener" href="https://source.starfort.tech/andrew/cmdarg#helpers">helper functions</a> to control how arguments are described and how usage (<code>--help</code>) messages are constructed&#x2F;printed</li>
<li>Using <a target="_blank" rel="noopener" href="https://source.starfort.tech/andrew/cmdarg#controlling-cmdargs-behavior-on-error">custom error handlers</a> to control what happens when the parser encounters an error in user input</li>
</ul>
<h2 id="Why-I-still-use-this-almost-two-decades-later"><a href="#Why-I-still-use-this-almost-two-decades-later" class="headerlink" title="Why I still use this almost two decades later"></a>Why I still use this almost two decades later</h2><p>A lot can change in 15 years. <a target="_blank" rel="noopener" href="https://github.com/akesterson/cmdarg/">cmdarg</a> is not the only game in town anymore. So why am I still using something I wrote 15 years ago? Well obviously I know this one, because I wrote it, so thats an easy win. But also because, in 15 years, I have yet to find another library that meets all these requirements:</p>
<h2 id="Why-I-still-use-this-almost-two-decades-later"><a href="#Why-I-still-use-this-almost-two-decades-later" class="headerlink" title="Why I still use this almost two decades later"></a>Why I still use this almost two decades later</h2><p>A lot can change in 15 years. <a target="_blank" rel="noopener" href="https://source.starfort.tech/andrew/cmdarg/">cmdarg</a> is not the only game in town anymore. So why am I still using something I wrote 15 years ago? Well obviously I know this one, because I wrote it, so thats an easy win. But also because, in 15 years, I have yet to find another library that meets all these requirements:</p>
<ul>
<li>Written purely in bash. Some contemporaries <a target="_blank" rel="noopener" href="https://github.com/nhoffman/argparse-bash">actually call some other language like python behind your back</a>. Others <a target="_blank" rel="noopener" href="https://github.com/matejak/argbash/tree/master">rely on some complicated preprocessor</a> that compiles your script down into a new script.</li>
<li>Generate help messages that sufficiently document usage for the user, including all flags, optional vs required, array inputs, copyright, etc. Some contemporaries do this, but the formatting is kinda gross. Others simply omit it and still expect you to do it.</li>
@@ -755,6 +755,11 @@ Options:
</div>
<div class="recent-posts-list">
<div class="recent-posts-item">
<div class="recent-posts-item-title">2026-05-15</div>
<a href="/2026/05/15/Devlog-20260518/"><div class="recent-posts-item-content">Devlog Entry</div></a>
</div>
<div class="recent-posts-item">
<div class="recent-posts-item-title">2026-02-23</div>
<a href="/2026/02/23/Why-Firefighting/"><div class="recent-posts-item-content">Why Firefighting</div></a>
@@ -770,11 +775,6 @@ Options:
<a href="/2026/01/30/News-2026-Week-4/"><div class="recent-posts-item-content">News - 2026 - Week 4</div></a>
</div>
<div class="recent-posts-item">
<div class="recent-posts-item-title">2026-01-25</div>
<a href="/2026/01/25/Two-kinds-of-programmers/"><div class="recent-posts-item-content">There are two kinds of programmers</div></a>
</div>
</div>
</div>
</article>