# HG changeset patch # User Henry S. Thompson # Date 1781190625 -3600 # Node ID ca6349278b8206d49b0fb902ebb669afaf13f914 # Parent 5072a23f99912dbcf70e2581ff2def46ce6b8000 better usage notes diff -r 5072a23f9991 -r ca6349278b82 bin/cdx2tsv.py --- a/bin/cdx2tsv.py Thu May 21 13:19:33 2026 +0100 +++ b/bin/cdx2tsv.py Thu Jun 11 16:10:25 2026 +0100 @@ -11,7 +11,7 @@ Note that 'key' and 'timestamp' are also available as global variables, so e.g. '(key,key.split(",")[0])' will yield the TLD. - For a callback instead of printing, include -c cb-mod for a module to + For a callback instead of printing, include -c cb-mod for a module to import and within which to call init() once and the cbf function for each index line ''' import json,sys @@ -31,10 +31,10 @@ else: break -if len(sys.argv)>1 and sys.argv[1][0]=='-': +if len(sys.argv)==1 or sys.argv[1][0]=='-': print("""Reads index lines from stdin and extracts values from json dict part - Usage: cdx2tsv.py [-i n] [-c callback-fn] fieldspecs... + Usage: cdx2tsv.py [-i n] [-c callback-module] fieldspecs... fieldspec is either a name or a quoted python tuple of a name and an expression with free variable f which will be evaluated with f