]> granicus.if.org Git - python/commitdiff
SF patch #1038388: __main__ for whichdb.py
authorRaymond Hettinger <python@rcn.com>
Wed, 20 Oct 2004 07:17:16 +0000 (07:17 +0000)
committerRaymond Hettinger <python@rcn.com>
Wed, 20 Oct 2004 07:17:16 +0000 (07:17 +0000)
(Contributed by Oleg Broytmann.)

Lib/whichdb.py
Misc/NEWS

index deb8a0218d790dfff1360a79da20e62d1a9dd4a1..cc5ced3acd1ec053bed02eb6c5cbb4d851d3ba2b 100644 (file)
@@ -1,3 +1,4 @@
+# !/usr/bin/env python
 """Guess which db package to use to open a db file."""
 
 import os
@@ -110,3 +111,7 @@ def whichdb(filename):
 
     # Unknown
     return ""
+
+if __name__ == "__main__":
+    for filename in sys.argv[1:]:
+        print whichdb(filename) or "UNKNOWN", filename
index 0d5dcc5d1c181088ccd2151a3ea155ed54a35672..828b1d0c374f9b672079bf6e32fa912db0372465 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -22,6 +22,8 @@ Extension Modules
 Library
 -------
 
+- The whichdb module can now be run from the command line.
+
 - Bug #1045381: time.strptime() can now infer the date using %U or %W (week of
   the year) when the day of the week and year are also specified.