@@ -62,8 +62,6 @@ def main(argsl=None): # type: (List[str]) -> int
62
62
"--print-index" , action = "store_true" , help = "Print node index" )
63
63
exgroup .add_argument ("--print-metadata" ,
64
64
action = "store_true" , help = "Print document metadata" )
65
- exgroup .add_argument ("--version" , action = "store_true" ,
66
- help = "Print version" )
67
65
68
66
exgroup = parser .add_mutually_exclusive_group ()
69
67
exgroup .add_argument ("--strict" , action = "store_true" , help = "Strict validation (unrecognized or out of place fields are error)" ,
@@ -79,11 +77,18 @@ def main(argsl=None): # type: (List[str]) -> int
79
77
exgroup .add_argument ("--debug" , action = "store_true" ,
80
78
help = "Print even more logging" )
81
79
82
- parser .add_argument ("schema" , type = str )
80
+ parser .add_argument ("schema" , type = str , nargs = "?" , default = None )
83
81
parser .add_argument ("document" , type = str , nargs = "?" , default = None )
82
+ parser .add_argument ("--version" , "-v" , action = "store_true" ,
83
+ help = "Print version" , default = None )
84
+
84
85
85
86
args = parser .parse_args (argsl )
86
87
88
+ if args .version is None and args .schema is None :
89
+ print ('%s: error: too few arguments' % sys .argv [0 ])
90
+ return 1
91
+
87
92
if args .quiet :
88
93
_logger .setLevel (logging .WARN )
89
94
if args .debug :
@@ -92,10 +97,10 @@ def main(argsl=None): # type: (List[str]) -> int
92
97
pkg = pkg_resources .require ("schema_salad" )
93
98
if pkg :
94
99
if args .version :
95
- print ("%s %s" % (sys .argv [0 ], pkg [0 ].version ))
100
+ print ("%s Current version: %s" % (sys .argv [0 ], pkg [0 ].version ))
96
101
return 0
97
102
else :
98
- _logger .info ("%s %s" , sys .argv [0 ], pkg [0 ].version )
103
+ _logger .info ("%s Current version: %s" , sys .argv [0 ], pkg [0 ].version )
99
104
100
105
# Get the metaschema to validate the schema
101
106
metaschema_names , metaschema_doc , metaschema_loader = schema .get_metaschema ()
0 commit comments