Deutsch English Français Italiano |
<vs2suo$cka4$1@news1.tnib.de> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!news1.tnib.de!feed.news.tnib.de!news.tnib.de!.POSTED.torres.zugschlus.de!not-for-mail From: Marc Haber <mh+usenetspam1118@zugschl.us> Newsgroups: comp.os.linux.misc Subject: Re: Useless Use Of Regexes Date: Thu, 27 Mar 2025 07:58:32 +0100 Organization: private site, see http://www.zugschlus.de/ for details Message-ID: <vs2suo$cka4$1@news1.tnib.de> 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> <vs23sj$2s4s3$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 27 Mar 2025 06:58:33 -0000 (UTC) Injection-Info: news1.tnib.de; posting-host="torres.zugschlus.de:81.169.166.32"; logging-data="414020"; mail-complaints-to="abuse@tnib.de" X-Newsreader: Forte Agent 6.00/32.1186 Bytes: 3216 Lines: 62 Lawrence D'Oliveiro <ldo@nz.invalid> wrote: >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” ... All of them. You could have it easier with getopt, but oh my. Greetings Marc -- ---------------------------------------------------------------------------- Marc Haber | " Questions are the | Mailadresse im Header Rhein-Neckar, DE | Beginning of Wisdom " | Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 6224 1600402