check for and warn about unknown options
authorgenone <genone@gentoo.org>
Wed, 30 May 2007 22:52:58 +0000 (22:52 -0000)
committergenone <genone@gentoo.org>
Wed, 30 May 2007 22:52:58 +0000 (22:52 -0000)
svn path=/; revision=406

trunk/ChangeLog
trunk/src/equery/equery

index fd53aed697a2ab9249f71a663dbfa51db6c9e0f2..26f013108f39d7c8ff105be8e47d9ccbb60533cb 100644 (file)
@@ -3,6 +3,7 @@
        * glsa-check: new --emergelike option to use the best version 
        within the same SLOT instead of the one with the smallest delta.
        * glsa-check: prefer visible upgrades to masked upgrades
+       * equery: check for and warn about unknown options (bug 119674)
 
 2007-05-21: Paul Varner <fuzzyray@gentoo.org>
        * echangelog: Add patch from genstef to fix issues from Bug 176337
index 2165ead544029445a0027829becdba310062c5c7..3e65a605b5b58faec7ddbcb74f10c2cbeb5a4ebc 100755 (executable)
@@ -137,6 +137,8 @@ class CmdListFiles(Command):
                                opts["filter"] = x[9:].split(',')
                        elif x[0] == "/":
                                die(2, "The query '" + pp.pkgquery(x) + "' does not appear to be a valid package specification")
+                       elif x[0] == "-":
+                               print_warn("unknown local option %s, ignoring" % x)
                        else:
                                query = x
 
@@ -342,6 +344,8 @@ class CmdListBelongs(Command):
                                opts["fullRegex"] = 1
                        elif x in ["-n", "--name-only"]:
                                opts["nameOnly"] = 1
+                       elif x[0] == "-":
+                               print_warn("unknown local option %s, ignoring" % x)
                        else:
                                query.append(x)
 
@@ -468,6 +472,8 @@ class CmdDisplayUSEs(Command):
                                break
                        elif x in ["-a", "--all"]:
                                opts["allPackages"] = True
+                       elif x[0] == "-":
+                               print_warn("unknown local option %s, ignoring" % x)
                        else:
                                query = x
 
@@ -666,6 +672,8 @@ class CmdDisplayDepGraph(Command):
                                opts["fancyFormatting"] = 0
                        elif x[:8] == "--depth=":
                                opts["depth"] = int(x[8:])
+                       elif x[0] == "-":
+                               print_warn("unknown local option %s, ignoring" % x)
                        else:
                                query = x
 
@@ -772,6 +780,8 @@ class CmdDisplaySize(Command):
                                opts["regex"] = 1
                        elif x in ["-e", "--exact-name"]:
                                opts["exact"] = 1
+                       elif x[0] == "-":
+                               print_warn("unknown local option %s, ignoring" % x)
                        else:
                                query = x
 
@@ -898,6 +908,8 @@ class CmdCheckIntegrity(Command):
                        if x in ["-h","--help"]:
                                need_help = 1
                                break
+                       elif x[0] == "-":
+                               print_warn("unknown local option %s, ignoring" % x)
                        else:
                                query = x
 
@@ -1011,6 +1023,8 @@ class CmdWhich(Command):
                                break
                        elif x in ["-m", "--include-masked"]:
                                opts["includeMasked"] = True
+                       elif x[0] == "-":
+                               print_warn("unknown local option %s, ignoring" % x)
                        else:
                                query = x
 
@@ -1090,6 +1104,8 @@ class CmdListDepends(Command):
                                opts["spacing"] = int(x[10:])
                        elif x[:8] == "--depth=":
                                opts["depth"] = int(x[8:])
+                       elif x[0] == "-":
+                               print_warn("unknown local option %s, ignoring" % x)
                        else:
                                query = x
         
@@ -1277,6 +1293,8 @@ class CmdListPackages(Command):
                                opts["exact"] = 1
                        elif x in ["-d", "--duplicates"]:
                                opts["duplicates"] = 1
+                       elif x[0] == "-":
+                               print_warn("unknown local option %s, ignoring" % x)
                        else:
                                query = x
 
@@ -1493,6 +1511,8 @@ class CmdFindUSEs(Command):
                                opts["includeOverlayTree"] = 1
                        elif x in ["-m", "--exclude-masked"]:
                                opts["includeMasked"] = 0
+                       elif x[0] == "-":
+                               print_warn("unknown local option %s, ignoring" % x)
                        else:
                                query = x
 
@@ -1735,10 +1755,13 @@ def parseArgs(args):
                        Config["verbosityLevel"] = 0
                elif expand(x) in Known_commands.keys():
                        command = Known_commands[expand(x)]
-                       local_opts = args[i+1:]
+                       local_opts.extend(args[i+1:])
                        if showhelp:
                                local_opts.append("--help")
                        break
+               else:
+                       print_warn("unknown global option %s, reusing as local option" % x)
+                       local_opts.append(x)
                
        if not command and showhelp:
                printUsage()