Source

ocaml-pkgbuild / bashparam.ml

Diff from to

bashparam.ml

 let string_of_param param =
   match param with
     Param(str) -> str | ParamArray (_) -> string_of_param_elem param 0
+
+let make_lookup expander name plist =
+  let param = try List.assoc name plist
+  with Not_found -> Param("")
+  in expander param
+
+(** Lookup the value of a parameter in string context.
+    This is like $FOO in bash. *)
+let assoc_str = make_lookup string_of_param
+
+(** Lookup the value of a parameter in array context.
+    This is like ${FOO[@]} in bash. *)
+let assoc_arr = make_lookup string_of_array_param
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.