| Deutsch English Français Italiano |
|
<vs23sj$2s4s3$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups: comp.os.linux.misc
Subject: Re: Useless Use Of Regexes
Date: Wed, 26 Mar 2025 23:50:43 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 52
Message-ID: <vs23sj$2s4s3$1@dont-email.me>
References: <vrsfkv$1md7d$1@dont-email.me> <vrsjva$1oouq$1@dont-email.me>
<vrso4m$1toah$3@dont-email.me> <sm0o6xpqxwf.fsf@lakka.kapsi.fi>
<vru632$lb7$1@news1.tnib.de> <vrvigv$gce5$3@dont-email.me>
<vs09u6$61ff$1@news1.tnib.de> <vs1lgs$2f333$2@dont-email.me>
<vs1ou7$9qn3$1@news1.tnib.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 27 Mar 2025 00:50:44 +0100 (CET)
Injection-Info: dont-email.me; posting-host="5e3725a960a956e95c3230978fe8baf9";
logging-data="3019651"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1872Y6LeqZRDdmPeVXdFnpS"
User-Agent: Pan/0.162 (Pokrosvk)
Cancel-Lock: sha1:xh/qCQ9myquHIX8PAJ68DEuHdoM=
Bytes: 2814
On Wed, 26 Mar 2025 21:43:51 +0100, Marc Haber wrote:
> Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>>
>>On Wed, 26 Mar 2025 08:21:42 +0100, Marc Haber wrote:
>>> It has become better since I usually start off with ChatGPT which
>>> takes care of the boilerplate stuff.
>>
>>The main point of using a very-high-level language (like bash) is that
>>you shouldn’t need any boilerplate stuff.
>
> As soon as you make it flexlbie, with command line options, you begin
> typing getopt or GetOptions stuff and that's pretty much boilerplate.
Well, I do do that. Mainly it’s just a loop, though, e.g.
for ((;;)); do
if [ "${1:0:2}" != "--" ]; then
break
fi
if [ "$1" == "--" ]; then
shift
break
fi
opt="${1:2:${#1}}"
shift
val="${opt#*=}"
if [ "$val" = "$opt" ]; then
val=""
fi
opt="${opt%%=*}"
if [ "$opt" = "animation" ]; then
animation=1
elif [ "$opt" = "blender" ]; then
blender="$val"
elif [ "$opt" = "camera" ]; then
camera="$val"
elif [ "$opt" = "collections" ]; then
collections="$val"
elif [ "$opt" = "crash-protect" ]; then
crash_protect=1
elif [ "$opt" = "crash-retry-count" ]; then
crash_retry_count="$val"
elif [ "$opt" = "digits" ]; then
digits="$val"
...
else
opterror "bad option $opt"
fi
done
I would say, only a few lines in there count as “boilerplate” ...