From 4936adab75616e1619d7907568da1efd77660494 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 14 Dec 2020 08:55:56 -0800 Subject: [PATCH] add option to output number of words --- xwords4/dawg/dawg2dict.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xwords4/dawg/dawg2dict.py b/xwords4/dawg/dawg2dict.py index d27ef70d6..9b3d11d2a 100755 --- a/xwords4/dawg/dawg2dict.py +++ b/xwords4/dawg/dawg2dict.py @@ -167,6 +167,9 @@ def process(args): if args.GET_SUM: print( '{}'.format(md5Sum), file=sys.stdout ) sys.exit(0) + elif args.GET_NWORDS: + print( '{}'.format(nWords), file=sys.stdout ) + sys.exit(0) nodeSize = 0 isUTF8 = False @@ -246,6 +249,8 @@ def mkParser(): action = 'store_true', help = 'write header user-visible message to stdout') parser.add_argument('--get-sum', dest = 'GET_SUM', default = False, action = 'store_true', help = 'write md5sum to stdout') + parser.add_argument('--get-nwords', dest = 'GET_NWORDS', default = False, + action = 'store_true', help = 'write count of words to stdout') parser.add_argument('--separator', dest = 'DELIM', default = '', help = 'printed between tiles') # [-raw | -json] [-get-sum] [-get-desc] -dict