Source

ocaml-pkgbuild / bashexpand.ml

Diff from to

File bashexpand.ml

-open Bashparams
+open Bashparam
 open Printf
 
 module Bashexpand =
 
     let param_lookup expander name plist =
       let param = try List.assoc name plist
-        with Not_found -> Bashparams.param_of_string ""
+        with Not_found -> Param("")
       in expander param
 
     (** Lookup the value of a parameter in string context.
         This is like $FOO in bash. *)
-    let param_str_ctx = param_lookup Bashparams.string_of_param
+    let param_str_ctx = param_lookup Bashparam.string_of_param
 
     (** Lookup the value of a parameter in array context.
         This is like ${FOO[@]} in bash. *)
           match str.[idx] with
           | '$' ->
               begin
-                try
-                  match expand_name (idx+1) with (newidx, name) ->
-                    (newidx, param_str_ctx name params)
+                try match expand_name (idx+1) with (newidx, name) ->
+                  (newidx, param_str_ctx name params)
                 with Invalid_argument(_) -> raise (ExpandError idx)
               end
           | '{' ->
   end
 
 let _ =
-  let paramslist = [ ("FOO", Bashparams.param_of_string "BAR") ;
-                     ("BAR", Bashparams.param_of_string "Hello, World!") ] in
+  let paramslist = [ ("FOO", Param("BAR")) ;
+                     ("BAR", Param("Hello, World!")) ] in
   print_endline (Bashexpand.parameter_expand
                    "Substitutions${BAZ:- IS WORKING}!" paramslist)