emerge: add --misspell-suggestions=n option
authorZac Medico <zmedico@gentoo.org>
Thu, 28 Apr 2011 16:10:02 +0000 (09:10 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 28 Apr 2011 16:10:02 +0000 (09:10 -0700)
This will fix bug #363137.

man/emerge.1
pym/_emerge/depgraph.py
pym/_emerge/help.py
pym/_emerge/main.py

index 67f3e4796befc4e278fc3075a8c089120d8b47de..56823a8804a64d91074c5b2a7b77c594338d8eb8 100644 (file)
@@ -1,4 +1,4 @@
-.TH "EMERGE" "1" "Mar 2011" "Portage VERSION" "Portage"
+.TH "EMERGE" "1" "Apr 2011" "Portage VERSION" "Portage"
 .SH "NAME"
 emerge \- Command\-line interface to the Portage system
 .SH "SYNOPSIS"
@@ -438,6 +438,12 @@ order to avoid excess load. See \fBmake\fR(1) for information about
 analogous options that should be configured via \fBMAKEOPTS\fR in
 \fBmake.conf\fR(5).
 .TP
+.BR "\-\-misspell\-suggestions < y | n >"
+Enable or disable misspell suggestions. By default, emerge will show
+a list of packages with similar names when a package doesn't exist.
+The \fIEMERGE_DEFAULT_OPTS\fR variable may be used to disable this
+option by default.
+.TP
 .BR "\-\-newuse " (\fB\-N\fR)
 Tells emerge to include installed packages where USE
 flags have changed since compilation. This option
index 84e7d24f162b6c73b87a12f200ff9f05eda1d0b6..7db5ae3f34541f505ab648e1b983f045251117e6 100644 (file)
@@ -2757,7 +2757,9 @@ class depgraph(object):
                        mask_docs = True
                else:
                        writemsg_stdout("\nemerge: there are no ebuilds to satisfy "+green(xinfo)+".\n", noiselevel=-1)
-                       if isinstance(myparent, AtomArg):
+                       if isinstance(myparent, AtomArg) and \
+                               self._frozen_config.myopts.get(
+                               "--misspell-suggestions", "y") != "n":
                                cp = myparent.atom.cp.lower()
                                cat, pkg = portage.catsplit(cp)
                                if cat == "null":
index a928a85fb6e2d3442d853eaa985b97f5017c24a7..fb1e129e74dc36b3f41c0638c301884a4608698d 100644 (file)
@@ -512,6 +512,15 @@ def help(myopts, havecolor=1):
                for line in wrap(desc, desc_width):
                        print(desc_indent + line)
                print()
+               print("       " + green("--misspell-suggestions") + " < %s | %s >" % \
+                       (turquoise("y"), turquoise("n")))
+               desc = "Enable or disable misspell suggestions. By default, " + \
+                       "emerge will show a list of packages with similar names " + \
+                       "when a package doesn't exist. The EMERGE_DEFAULT_OPTS " + \
+                       "variable may be used to disable this option by default"
+               for line in wrap(desc, desc_width):
+                       print(desc_indent + line)
+               print()
                print("       "+green("--newuse")+" ("+green("-N")+" short option)")
                desc = "Tells emerge to include installed packages where USE " + \
                        "flags have changed since compilation. This option " + \
index 6ae267f5a524fee3e45ddedbc19dd73955dddeb0..82b1444c5c8b64eb419856948fa4eabc0ed747cb 100644 (file)
@@ -686,6 +686,12 @@ def parse_opts(tmpcmdline, silent=False):
                        "action" : "store"
                },
 
+               "--misspell-suggestions": {
+                       "help"    : "enable package name misspell suggestions",
+                       "type"    : "choice",
+                       "choices" : ("y", "n")
+               },
+
                "--with-bdeps": {
                        "help":"include unnecessary build time dependencies",
                        "type":"choice",