Allow users to specify the import path manually, if the default (current

working directory) is undesired.
main
Vincent Driessen 13 years ago
parent 2ac6c1faa3
commit a111db13fd

@ -118,6 +118,7 @@ def parse_args():
parser.add_argument('--host', '-H', default='localhost', help='The Redis hostname (default: localhost)')
parser.add_argument('--port', '-p', type=int, default=6379, help='The Redis portnumber (default: 6379)')
parser.add_argument('--db', '-d', type=int, default=0, help='The Redis database (default: 0)')
parser.add_argument('--path', '-P', default='.', help='Specify the import path.')
parent_parser = argparse.ArgumentParser(add_help=False)
parent_parser.add_argument('--interval', '-i', metavar='N', type=float, default=0, help='Updates stats every N seconds (default: don\'t poll)')
@ -137,11 +138,11 @@ def parse_args():
def main():
import sys
sys.path.insert(0, '.')
args = parse_args()
if args.path:
sys.path = args.path.split(':') + sys.path
# Setup connection to Redis
redis_conn = redis.Redis(host=args.host, port=args.port, db=args.db)
use_redis(redis_conn)

@ -1,4 +1,5 @@
#!/usr/bin/env python
import sys
import argparse
import logbook
import redis
@ -46,6 +47,7 @@ def parse_args():
parser.add_argument('--burst', '-b', action='store_true', default=False, help='Run in burst mode (quit after all work is done)')
parser.add_argument('--name', '-n', default=None, help='Specify a different name')
parser.add_argument('--path', '-P', default='.', help='Specify the import path.')
parser.add_argument('--verbose', '-v', action='store_true', default=False, help='Show more output')
parser.add_argument('queues', nargs='*', default=['default'], help='The queues to listen on (default: \'default\')')
@ -53,11 +55,11 @@ def parse_args():
def main():
import sys
sys.path.insert(0, '.')
args = parse_args()
if args.path:
sys.path = args.path.split(':') + sys.path
setup_loghandlers(args)
# Setup connection to Redis

Loading…
Cancel
Save