Repository: spack/spack

Issue:
Request to mention that you can uninstall package by hash
Request to mention that you can use hashes in `spack uninstall -h` and `Error: You can either:`.

### Rationale
I happened to have created multiple modules, and I hope to delete one of them, but failed like this: 
```
$ spack uninstall openmpi
==> Error: openmpi@1.10.7%gcc@4.8.5~cuda matches multiple packages:

    -- linux-centos7-x86_64 / gcc@4.8.5 -----------------------------
    26w2v3w openmpi@1.10.7%gcc ~cuda+cxx_exceptions fabrics=none ~java~legacylaunchers~memchecker~pmi schedulers=none ~sqlite3~thread_multiple+vt
    f4cgywb openmpi@1.10.7%gcc ~cuda+cxx_exceptions fabrics=none ~java~legacylaunchers~memchecker~pmi schedulers=none ~sqlite3~thread_multiple+vt
==> Error: You can either:
    a) use a more specific spec, or
    b) use `spack uninstall --all` to uninstall ALL matching specs.
```
After searching for a while, I found the solution in #2199 to use hash. Although, the problem was solved, I really think the last sentence in this [comment](https://github.com/spack/spack/issues/2199#issuecomment-265968123) should be considered again.

### Description
Sometimes newbies make mistakes to create duplicated spack modules, but there is no hint for them to use the harsh to uninstall the specific package. Thus, it could be helpful to mention that you can use hashes in `spack uninstall -h` and `Error: You can either:`






Discussion:
Oh, hey @ejcjason , didn't even realise you made this issue :smile: 

I did a PR to mention this in the error, so now it says:

```
You can either:
    a) use a more specific spec, or
    b) specify the package by its hash (e.g. `spack uninstall /hash`), or
    c) use `spack uninstall --all` to uninstall ALL matching specs
```

Which clears it up a bit.
Hey @RobertRosca it's also a surprise that it's you who did the PR! I have almost forgotten about this issue. 
Thanks!

Resolving patch:
diff --git a/lib/spack/spack/cmd/uninstall.py b/lib/spack/spack/cmd/uninstall.py
--- a/lib/spack/spack/cmd/uninstall.py
+++ b/lib/spack/spack/cmd/uninstall.py
@@ -26,7 +26,7 @@
 
 error_message = """You can either:
     a) use a more specific spec, or
-    b) specify the package by its hash (e.g. `spack uninstall /hash`), or
+    b) specify the spec by its hash (e.g. `spack uninstall /hash`), or
     c) use `spack uninstall --all` to uninstall ALL matching specs.
 """
 
@@ -40,6 +40,18 @@
 
 
 def setup_parser(subparser):
+    epilog_msg = ("Specs to be uninstalled are specified using the spec syntax"
+                  " (`spack help --spec`) and can be identified by their "
+                  "hashes. To remove packages that are needed only at build "
+                  "time and were not explicitly installed see `spack gc -h`."
+                  "\n\nWhen using the --all option ALL packages matching the "
+                  "supplied specs will be uninstalled. For instance, "
+                  "`spack uninstall --all libelf` uninstalls all the versions "
+                  "of `libelf` currently present in Spack's store. If no spec "
+                  "is supplied, all installed packages will be uninstalled. "
+                  "If used in an environment, all packages in the environment "
+                  "will be uninstalled.")
+    subparser.epilog = epilog_msg
     subparser.add_argument(
         '-f', '--force', action='store_true', dest='force',
         help="remove regardless of whether other packages or environments "
@@ -48,12 +60,8 @@ def setup_parser(subparser):
         subparser, ['recurse_dependents', 'yes_to_all', 'installed_specs'])
     subparser.add_argument(
         '-a', '--all', action='store_true', dest='all',
-        help="USE CAREFULLY. Remove ALL installed packages that match each "
-        "supplied spec. i.e., if you `uninstall --all libelf`,"
-        " ALL versions of `libelf` are uninstalled. If no spec is "
-        "supplied, all installed packages will be uninstalled. "
-        "If used in an environment, all packages in the environment "
-        "will be uninstalled.")
+        help="remove ALL installed packages that match each supplied spec"
+    )
 
 
 def find_matching_specs(env, specs, allow_multiple_matches=False, force=False):


Test patch: