all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: 45893@debbugs.gnu.org
Subject: [bug#45893] [PATCH v2 0/3] DRAFT: Hint command line typo
Date: Sat, 16 Jan 2021 01:09:41 +0100	[thread overview]
Message-ID: <865z3xlp2y.fsf@gmail.com> (raw)
In-Reply-To: <20210115163732.53665-1-zimon.toutoune@gmail.com> (zimoun's message of "Fri, 15 Jan 2021 17:37:32 +0100")

Hi,

Here a v2 with some revamp.  It looks like this:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix show --laod-pth hello
hint: Do you mean `load-path'?

guix show: error: laod-pth: unrecognized option

$ ./pre-inst-env guix chow --laod-pth hello
hint: Do you mean `show'?

guix: chow: command not found
Try `guix --help' for more information.

$ ./pre-inst-env guix abcde
hint: Do you mean `archive', `gc', `pack', `size'?

guix: abcde: command not found
Try `guix --help' for more information.

$ ./pre-inst-env guix show --abcdefijk hello
hint: Do you mean `help', `version', `load-path'?

guix show: error: abcdefijk: unrecognized option
--8<---------------cut here---------------end--------------->8---

First, the v2 remove of car, cdr etc in favor of ’match’.  And, I do not
know if my Emacs has the correct setup for indentation.  Sorry for that.

Second, the 3 added pieces are:

 1. levenshtein-distance and string-closest in guix/utils.scm (patch 2)
 2. option-hint in guix/scripts.scm (patch 2)
 3. command-hint in guix/ui.scm (patch 3)

#1 eases the reuses.  Well, guix/utils.scm because I lacked imagination.

The option-hint is only added in ’parse-command-line’ and not
’args-fold*’ therefore currently this hint does not work for all the
subcommand.  That’s the reason of the first patch that fixes for “guix
search” and “guix show”.  If it is makes sense, I can easily replace all
the ’args-fold*’ by ’parse-command-line’.  I am in favor of that for 2
reasons:

 a) one function to do one thing
 b) recommend this parse-command-line function for the new extensions

Last, in this mood, a hint is added to the subcommand itself.  Well, I
am not sure it makes sense…  Well, that’s just a proposal.

Ah, I have not been inspired by the commit message. :-)

All the best,
simon

zimoun (3):
  scripts: search, show: Replace 'args-fold*' by 'parse-command-line'.
  guix: scripts: Add hint for option typo.
  ui: Add command hint.

 guix/scripts.scm        | 21 +++++++++++++++++
 guix/scripts/search.scm |  7 ++----
 guix/scripts/show.scm   |  8 ++-----
 guix/ui.scm             | 16 +++++++++++++
 guix/utils.scm          | 51 ++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 91 insertions(+), 12 deletions(-)


base-commit: 884f320e7ceb35cb8472510e47fc5f1944675d82
--
2.29.2




  parent reply	other threads:[~2021-01-16  0:20 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 16:37 [bug#45893] [PATCH 0/2] DRAFT: Hint for options zimoun
2021-01-15 16:39 ` [bug#45893] [PATCH 1/2] scripts: search, show: Replace 'args-fold*' by 'parse-command-line' zimoun
2021-01-15 16:39   ` [bug#45893] [PATCH 2/2] guix: scripts: Add hint for option typo zimoun
2021-01-19 17:20   ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-19 17:35     ` zimoun
2021-01-16  0:09 ` zimoun [this message]
2021-01-16  0:26   ` [bug#45893] [PATCH v2 1/3] scripts: search, show: Replace 'args-fold*' by 'parse-command-line' zimoun
2021-01-16  0:26     ` [bug#45893] [PATCH v2 2/3] guix: scripts: Add hint for option typo zimoun
2021-01-19 17:31       ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-16  0:26     ` [bug#45893] [PATCH v2 3/3] ui: Add command hint zimoun
2021-01-19 17:38       ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-19 18:01         ` zimoun
2021-01-26 20:53           ` Ludovic Courtès
2021-01-26 21:27             ` zimoun
2021-01-19 23:59         ` [bug#45893] Hint for package name: too slow! zimoun
2021-01-20  9:49           ` [bug#45893] Hint for package name: full matrix iteration zimoun
2021-01-26 21:00           ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-26 21:44             ` zimoun
2021-01-27 22:09               ` Ludovic Courtès
2021-01-19 21:28 ` [bug#45893] [PATCH v3 1/3] utils: Add string distance zimoun
2021-01-19 21:28   ` [bug#45893] [PATCH v3 2/3] guix: scripts: Add hint for option typo zimoun
2021-01-19 21:28   ` [bug#45893] [PATCH v3 3/3] ui: Add hint for command typo zimoun
2021-01-26 21:18   ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-26 21:20   ` Ludovic Courtès
2021-01-26 22:05     ` zimoun
2021-02-03 11:28       ` bug#45893: " Ludovic Courtès
2021-02-03 12:15         ` [bug#45893] " zimoun
2021-02-24 23:47           ` option hint for all commands? zimoun
2021-03-01 14:07             ` Hartmut Goebel
2021-02-04 19:53   ` bug#46303: Typo helper doesn't always know which command is missing Leo Famulari
2021-02-04 21:29     ` zimoun
2021-02-04 23:08       ` [bug#45893] " zimoun

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=865z3xlp2y.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=45893@debbugs.gnu.org \
    /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.