changeset 6:ca6349278b82

better usage notes
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Thu, 11 Jun 2026 16:10:25 +0100
parents 5072a23f9991
children 10dfd4feeaa0
files bin/cdx2tsv.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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