2012-02-06 14:44:30 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
|
|
|
import sys
|
|
|
|
from os.path import basename
|
|
|
|
|
|
|
|
|
|
|
|
__meta__ = dict(
|
|
|
|
name='flickrscripts',
|
|
|
|
version='0.1.0',
|
|
|
|
entry_points={
|
|
|
|
'console_scripts': [
|
|
|
|
'flickrscripts = flickrscripts:route',
|
|
|
|
],
|
|
|
|
},
|
2012-02-06 14:50:03 +00:00
|
|
|
test_suite='nose.collector',
|
2012-02-06 14:44:30 +00:00
|
|
|
)
|
|
|
|
USAGE = 'Usage: {prog} <subcommand> [args]'
|
|
|
|
|
|
|
|
|
|
|
|
def route(sysargs=sys.argv[:]):
|
|
|
|
try:
|
|
|
|
subcommand = sysargs.pop(1)
|
|
|
|
import_name = 'flickrscripts.{}'.format(subcommand)
|
|
|
|
|
|
|
|
module = __import__(import_name, fromlist=[import_name])
|
|
|
|
return module.main(sysargs)
|
|
|
|
except IndexError:
|
|
|
|
print(USAGE.format(prog=basename(sysargs[0])), file=sys.stderr)
|
|
|
|
print('You must provide a subcommand', file=sys.stderr)
|
|
|
|
return 1
|