[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unhelpful "--help" output
From: |
Christopher Howard |
Subject: |
Re: Unhelpful "--help" output |
Date: |
Wed, 13 Nov 2024 13:35:43 -0900 |
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