summaryrefslogtreecommitdiffstats
path: root/reduce.py
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-07-20 19:47:43 +0800
committerPeng Wu <alexepico@gmail.com>2011-07-20 19:47:43 +0800
commit6bbdcff2c292258572072d01d9e170a298798513 (patch)
treefb71d21f26011fc25fe907cb5f75df0edbc88677 /reduce.py
parentad8c7df93d6735742b675a99b0c9ab412e77c317 (diff)
downloadtrainer-6bbdcff2c292258572072d01d9e170a298798513.zip
trainer-6bbdcff2c292258572072d01d9e170a298798513.tar.gz
trainer-6bbdcff2c292258572072d01d9e170a298798513.tar.xz
improve arguments handling in reduce.py
Diffstat (limited to 'reduce.py')
-rwxr-xr-xreduce.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/reduce.py b/reduce.py
index 62119e5..6ad9824 100755
--- a/reduce.py
+++ b/reduce.py
@@ -47,13 +47,15 @@ def iterateSubDirectory(oldroot, newroot, level):
if __name__ == '__main__':
parser = ArgumentParser(description='Reduce the levels of categories.')
- parser.add_argument('--level', action='store', nargs=1, default=2, \
+ parser.add_argument('--level', action='store', default=2, \
help='reduce to n levels of index')
parser.add_argument('origdir', action='store', \
help='original index directory')
- parser.add_argument('destdir', action='store', \
- help='reduced index directory')
+ parser.add_argument('--destdir', action='store', \
+ help='reduced index directory', \
+ default=os.path.join(config.getTextDir(), 'index'))
args = parser.parse_args()
- iterateSubDirectory(args.origdir, args.destdir, int(args.level[0]))
+ print(args)
+ iterateSubDirectory(args.origdir, args.destdir, args.level)
print('done')