mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Make the library work with python -m
.
This commit is contained in:
parent
ef0b9f0f52
commit
bef859632d
2 changed files with 13 additions and 4 deletions
5
pokedex/__main__.py
Normal file
5
pokedex/__main__.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
import sys
|
||||
|
||||
import pokedex.main
|
||||
|
||||
pokedex.main.main(*sys.argv)
|
|
@ -9,12 +9,12 @@ import pokedex.db.tables
|
|||
import pokedex.lookup
|
||||
from pokedex import defaults
|
||||
|
||||
def main():
|
||||
if len(sys.argv) <= 1:
|
||||
def main(*argv):
|
||||
if len(argv) <= 1:
|
||||
command_help()
|
||||
|
||||
command = sys.argv[1]
|
||||
args = sys.argv[2:]
|
||||
command = argv[1]
|
||||
args = argv[2:]
|
||||
|
||||
# XXX there must be a better way to get Unicode argv
|
||||
# XXX this doesn't work on Windows durp
|
||||
|
@ -316,3 +316,7 @@ Dump options:
|
|||
""".encode(sys.getdefaultencoding(), 'replace')
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(*sys.argv)
|
||||
|
|
Loading…
Reference in a new issue