···364364 match executable with
365365 | "export" ->
366366 let updated =
367367- handle_export_or_readonly `Export ctx args
367367+ handle_assignments `Export ctx args
368368 in
369369 let job =
370370 handle_job job
···374374 rest
375375 | "readonly" ->
376376 let updated =
377377- handle_export_or_readonly `Readonly ctx args
377377+ handle_assignments `Readonly ctx args
378378+ in
379379+ let job =
380380+ handle_job job
381381+ (`Built_in (updated >|= fun _ -> ()))
382382+ in
383383+ loop (Exit.value updated) job stdout_of_previous
384384+ rest
385385+ | "local" ->
386386+ let updated =
387387+ handle_assignments `Local ctx args
378388 in
379389 let job =
380390 handle_job job
···835845 in
836846 (Exit.zero ctx, List.concat cst)
837847838838- and handle_export_or_readonly kind ctx (assignments : string list) =
848848+ and handle_assignments kind ctx (assignments : string list) =
839849 let flags, assignments =
840850 List.fold_left
841851 (fun (fs, args) v ->
···848858 match kind with
849859 | `Export -> update ~export:true ~readonly:false
850860 | `Readonly -> update ~export:false ~readonly:true
861861+ | `Local ->
862862+ fun ctx ~param v ->
863863+ Exit.zero { ctx with local_state = (param, v) :: ctx.local_state }
851864 in
852865 let read_arg acc_ctx param =
853866 (* TODO: quoting? *)
···869882 match kind with
870883 | `Readonly -> S.pp_readonly Fmt.stdout ctx.state
871884 | `Export -> S.pp_export Fmt.stdout ctx.state
885885+ | `Local -> ()
872886 end;
873887 Exit.zero ctx
874888
+2-1
src/lib/types.ml
···3131 string ->
3232 (t, string) result
3333 (** Update the state with a new parameter mapping and whether or not it should
3434- exported to the environment (default false). *)
3434+ exported to the environment (default false), if it is readonly (default
3535+ false). *)
35363637 val remove : param:string -> t -> bool * t
3738 (** [remove ~param t] removes [param] from [t] if it exists. [bool] is [true]