projects
/
zzz-pokedex.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
4fe48ba
)
Added command_ prefix to CLI commands to fix import problems.
author
Eevee
<git@veekun.com>
Sat, 25 Jul 2009 09:43:30 +0000
(
02:43
-0700)
committer
Eevee
<git@veekun.com>
Sat, 25 Jul 2009 09:43:30 +0000
(
02:43
-0700)
pokedex/__init__.py
patch
|
blob
|
history
diff --git
a/pokedex/__init__.py
b/pokedex/__init__.py
index
89ad673
..
6954149
100644
(file)
--- a/
pokedex/__init__.py
+++ b/
pokedex/__init__.py
@@
-15,14
+15,14
@@
def main():
args = sys.argv[2:]
# Find the command as a function in this file
args = sys.argv[2:]
# Find the command as a function in this file
- func = globals().get(command, None)
- if func
and callable(func) and command != 'main'
:
+ func = globals().get(
"command_%s" %
command, None)
+ if func:
func(*args)
else:
func(*args)
else:
- help()
+
command_
help()
-def csvimport(engine_uri, directory='.'):
+def c
ommand_c
svimport(engine_uri, directory='.'):
import csv
from sqlalchemy.orm.attributes import instrumentation_registry
import csv
from sqlalchemy.orm.attributes import instrumentation_registry
@@
-129,7
+129,7
@@
def csvimport(engine_uri, directory='.'):
else:
print 'loaded'
else:
print 'loaded'
-def csvexport(engine_uri, directory='.'):
+def c
ommand_c
svexport(engine_uri, directory='.'):
import csv
session = connect(engine_uri)
import csv
session = connect(engine_uri)
@@
-160,7
+160,7
@@
def csvexport(engine_uri, directory='.'):
writer.writerow(csvs)
writer.writerow(csvs)
-def lookup(engine_uri, name):
+def
command_
lookup(engine_uri, name):
# XXX don't require uri! somehow
session = connect(engine_uri)
# XXX don't require uri! somehow
session = connect(engine_uri)
@@
-174,7
+174,7
@@
def lookup(engine_uri, name):
print object.__tablename__, object.name
print object.__tablename__, object.name
-def help():
+def
command_
help():
print u"""pokedex -- a command-line Pokédex interface
help Displays this message.
print u"""pokedex -- a command-line Pokédex interface
help Displays this message.