Skip to content

Add command and package suggestions#40895

Merged
tgamblin merged 3 commits intospack:developfrom
michaelkuhn:cmd-did-you-mean
Nov 5, 2023
Merged

Add command and package suggestions#40895
tgamblin merged 3 commits intospack:developfrom
michaelkuhn:cmd-did-you-mean

Conversation

@michaelkuhn
Copy link
Copy Markdown
Member

This adds suggestions of similar commands in case users mistype a command. Before:

$ spack spack
==> Error: spack is not a recognized Spack command or extension command; check with `spack commands`.

After:

$ spack spack
==> Error: spack is not a recognized Spack command or extension command; check with `spack commands`.

Did you mean one of the following commands?
  spec
  patch

@spackbot-app spackbot-app bot added the core PR affects Spack core functionality label Nov 5, 2023
@adamjstewart
Copy link
Copy Markdown
Member

Can we get this for package names too?

This adds suggestions of similar commands in case users mistype a
command. Before:
```
$ spack spack
==> Error: spack is not a recognized Spack command or extension command; check with `spack commands`.
```
After:
```
$ spack spack
==> Error: spack is not a recognized Spack command or extension command; check with `spack commands`.

Did you mean one of the following commands?
  spec
  patch
```
@michaelkuhn
Copy link
Copy Markdown
Member Author

I've pushed a new commit that should do it:

$ spack edit adios3     
==> Error: Package 'adios3' not found.
You may need to run 'spack clean -m' or use 'spack create' to create a new package.

Did you mean one of the following packages?
  adios
  adios2
  madis

@michaelkuhn michaelkuhn changed the title Add command suggestions Add command and package suggestions Nov 5, 2023
@adamjstewart
Copy link
Copy Markdown
Member

This may be the single greatest addition to Spack in the history of Spack.

Comment on lines +1520 to +1521
long_msg = "You may need to run 'spack clean -m'"
long_msg += " or use 'spack create' to create a new package."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this? At one time it was very common for issues with cached packages that were renamed. Nowadays this is less common and most of the time it was simply a typo.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I've kept the spack create suggestion for now, should we also remove that?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with keeping it. spack clean just felt like we were documenting a bug.

@spackbot-app spackbot-app bot added the tests General test capability(ies) label Nov 5, 2023
Copy link
Copy Markdown
Member

@tgamblin tgamblin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this is awesome! Thanks @michaelkuhn!

@tgamblin tgamblin merged commit 141c7de into spack:develop Nov 5, 2023
@tgamblin tgamblin modified the milestones: v0.21.1, v0.21.0 Nov 5, 2023
gabrielctn pushed a commit to gabrielctn/spack that referenced this pull request Nov 24, 2023
* Add command suggestions

This adds suggestions of similar commands in case users mistype a
command. Before:
```
$ spack spack
==> Error: spack is not a recognized Spack command or extension command; check with `spack commands`.
```
After:
```
$ spack spack
==> Error: spack is not a recognized Spack command or extension command; check with `spack commands`.

Did you mean one of the following commands?
  spec
  patch
```

* Add package name suggestions

* Remove suggestion to run spack clean -m
mtaillefumier pushed a commit to mtaillefumier/spack that referenced this pull request Dec 14, 2023
* Add command suggestions

This adds suggestions of similar commands in case users mistype a
command. Before:
```
$ spack spack
==> Error: spack is not a recognized Spack command or extension command; check with `spack commands`.
```
After:
```
$ spack spack
==> Error: spack is not a recognized Spack command or extension command; check with `spack commands`.

Did you mean one of the following commands?
  spec
  patch
```

* Add package name suggestions

* Remove suggestion to run spack clean -m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands core PR affects Spack core functionality tests General test capability(ies)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants