From: Christopher Howard <christopher@librehacker.com>
To: Ricardo Wurmus <rekado@elephly.net>
Cc: Luis Felipe <sirgazil@zoho.com>, guix-devel@gnu.org
Subject: Re: Unhelpful "--help" output
Date: Wed, 13 Nov 2024 13:35:43 -0900 [thread overview]
Message-ID: <87frnuwym8.fsf@librehacker.com> (raw)
In-Reply-To: <87ttcbc828.fsf@elephly.net> (Ricardo Wurmus's message of "Wed, 13 Nov 2024 19:17:19 +0100")
Ricardo Wurmus <rekado@elephly.net> writes:
>> I'm trying to
>> fix the bitrot in the emacs-guix "shell commands" code, which actually
>> parses the --help output using regexs, and and generates magit-popup
>> menus based on that. So little things like the number of spaces on the
>> line before the command name actually matter.
>
> Perhaps emacs-guix could instead fetch the list of items as an
> S-expression.
You mean through guix guile API, or...? As far as the help output, emacs-guix only knows if something is a "main command", as opposed to a description of the command grouping, or other help text, based on the number of spaces preceding it, which currently is 4 spaces. For options and switches, it can look for the "-" or "--".
The emacs-guix "shell command" functionality is essentially this engine that takes the perhaps dubious, but mostly effective, approach of automatically parsing all "help" and "--help" output to make it possible to manage all commands through an automatically generated magit-popup interface.
The switch and option regexs are not dependent an any exact amount of whitespace, so I think that part of it is resilient enough. But the regex for the main commands are dependent on the number of spaces before the start of the command name, in the command description line. So at least those number of spaces need to remain consistent, for the "shell command" functionality to work as it is currently coded.
--
Christopher Howard
next prev parent reply other threads:[~2024-11-13 22:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-12 16:23 Unhelpful "--help" output Christopher Howard
2024-11-12 16:31 ` indieterminacy
2024-11-12 19:56 ` Christopher Howard
2024-11-13 18:17 ` Ricardo Wurmus
2024-11-13 22:35 ` Christopher Howard [this message]
2024-11-14 10:37 ` Ricardo Wurmus
-- strict thread matches above, loose matches on Subject: below --
2024-11-12 13:14 Ricardo Wurmus
2024-11-12 15:03 ` Suhail Singh
2024-11-12 15:06 ` Luis Felipe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87frnuwym8.fsf@librehacker.com \
--to=christopher@librehacker.com \
--cc=guix-devel@gnu.org \
--cc=rekado@elephly.net \
--cc=sirgazil@zoho.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.