@@ -877,20 +877,26 @@ def runner_input(
877877 name , s_value = buf
878878
879879 # find corresponding input declaration
880- try :
881- decl = available_inputs [name ]
882- except KeyError :
880+ decl = available_inputs .get (name )
881+
882+ if not decl :
883+ # allow arbitrary runtime/hints overrides
884+ nmparts = name .split ("." )
885+ runtime_idx = next (
886+ (i for i , term in enumerate (nmparts ) if term in ("runtime" , "hints" )), - 1
887+ )
888+ if runtime_idx >= 0 and len (nmparts ) > (runtime_idx + 1 ):
889+ decl = available_inputs .get ("." .join (nmparts [:runtime_idx ] + ["_runtime" ]))
890+
891+ if not decl :
883892 runner_input_help (target )
884893 raise Error .InputError (f"No such input to { target .name } : { buf [0 ]} " )
885894
886895 # create a Value based on the expected type
887896 v = runner_input_value (s_value , decl .type , downloadable , root )
888897
889898 # insert value into input_env
890- try :
891- existing = input_env [name ]
892- except KeyError :
893- existing = None
899+ existing = input_env .get (name )
894900 if existing :
895901 if isinstance (v , Value .Array ):
896902 assert isinstance (existing , Value .Array ) and v .type .coerces (existing .type )
@@ -1053,6 +1059,17 @@ def runner_input_value(s_value, ty, downloadable, root):
10531059 return Value .Array (
10541060 ty .item_type , [runner_input_value (s_value , ty .item_type , downloadable , root )]
10551061 )
1062+ if isinstance (ty , Type .Any ):
1063+ # infer dynamically-typed runtime/hints overrides
1064+ try :
1065+ return Value .Int (int (s_value ))
1066+ except ValueError :
1067+ pass
1068+ try :
1069+ return Value .Float (float (s_value ))
1070+ except ValueError :
1071+ pass
1072+ return Value .String (s_value )
10561073 raise Error .InputError (
10571074 "No command-line support yet for inputs of type {}; workaround: specify in JSON file with --input" .format (
10581075 str (ty )
0 commit comments