Displaying 10 results from an estimated 10 matches for "column_wrap".
2016 Jul 13
0
[PATCH v3 2/2] mllib: Getopt: support hidden options
...mllib/getopt.ml
@@ -43,6 +43,8 @@ type t = {
   usage_msg : usage_msg;
 }
 
+let hidden_option_description = ""
+
 external getopt_parse : string array -> (c_keys * spec * doc) array -> ?anon_fun:anon_fun -> usage_msg -> unit = "guestfs_int_mllib_getopt_parse"
 
 let column_wrap = 38
@@ -56,6 +58,11 @@ let show_help h () =
   let prologue = sprintf (f_"%s\nOptions:\n") h.usage_msg in
   Buffer.add_string b prologue;
 
+  let specs = List.filter (
+    fun (_, _, doc) ->
+      doc <> hidden_option_description
+  ) h.specs in
+
   List.iter (
     fun (ke...
2016 Jul 13
3
[PATCH v3 1/2] OCaml tools: add and use a Getopt module
...* spec * doc) list
+
+type t = {
+  mutable specs : speclist;
+  anon_fun : anon_fun option;
+  usage_msg : usage_msg;
+}
+
+external getopt_parse : string array -> (c_keys * spec * doc) array -> ?anon_fun:anon_fun -> usage_msg -> unit = "guestfs_int_mllib_getopt_parse"
+
+let column_wrap = 38
+
+let show_help h () =
+  let b = Buffer.create 1024 in
+
+  let spaces n =
+    String.make n ' ' in
+
+  let prologue = sprintf (f_"%s\nOptions:\n") h.usage_msg in
+  Buffer.add_string b prologue;
+
+  List.iter (
+    fun (keys, spec, doc) ->
+      let columns = ref 0...
2016 Jul 11
2
[PATCH v2] OCaml tools: add and use a Getopt module
...= open_memstream (&buf, &buf_len);
+  if (f == NULL)
+    error (EXIT_FAILURE, errno, "open_memstream");
+
+  fprintf (f, _("%s\n"
+                "Options:\n"),
+           String_val (usage_msgv));
+
+  specs_len = Wosize_val (specsv);
+
+  static const int column_wrap = 38;
+
+  for (i = 0; i < specs_len; ++i) {
+    size_t len, j;
+    const char *param = NULL;
+    int columns = 0;
+
+    specv = Field (specsv, i);
+    keysv = Field (specv, 0);
+    actionv = Field (specv, 1);
+    docv = Field (specv, 2);
+    len = Wosize_val (keysv);
+
+    if (len == 0...
2016 Jul 15
5
[PATCH 0/3] mllib: Various fixes and changes to Getopt module.
The second patch is obviously not complete yet - for discussion only.
Rich.
2016 Jun 24
2
[PATCH] RFC: OCaml tools: add and use a Getopt module
...amp;buf_len);
+  if (f == NULL)
+    error (EXIT_FAILURE, errno, "open_memstream");
+
+  fprintf (f, _("%s: %s\n"
+                "Options:\n"),
+           guestfs_int_program_name, String_val (usage_msgv));
+
+  specs_len = Wosize_val (specsv);
+
+  static const int column_wrap = 38;
+
+  for (i = 0; i < specs_len; ++i) {
+    size_t len, j;
+    const char *param = NULL;
+    int columns = 0;
+
+    specv = Field (specsv, i);
+    keysv = Field (specv, 0);
+    actionv = Field (specv, 1);
+    docv = Field (specv, 2);
+    len = Wosize_val (keysv);
+
+    if (len == 0...
2018 Aug 23
3
[PATCH v2 0/2] add output selection for --machine-readable
Hi,
this adds the possibility to select the output for --machine-readable
in OCaml tools.
The possible choices are:
* --machine-readable: to stdout, like before
* --machine-readable=file:name-of-file: to the specified file
* --machine-readable=stream:stdout: explicitly to stdout
* --machine-readable=stream:stderr: explicitly to stderr
This makes it possible to add additional output for
2016 Jul 18
0
[PATCH v2 2/3] mllib: Use L"..." and S '...' for long and short options.
...truct
+  type option_name = S of char | L of string
+end
+open OptionName
+
+type keys = option_name list
 type doc = string
 type usage_msg = string
 type anon_fun = (string -> unit)
@@ -49,6 +54,14 @@ external getopt_parse : string array -> (c_keys * spec * doc) array -> ?anon_fun
 
 let column_wrap = 38
 
+let string_of_option_name = function
+  | S c -> sprintf "-%c" c
+  | L s -> "--" ^ s
+
+let string_of_option_name_no_dashes = function
+  | S c -> String.make 1 c
+  | L s -> s
+
 let show_help h () =
   let b = Buffer.create 1024 in
 
@@ -58,10 +71,11 @@ le...
2016 Jul 18
4
[PATCH v2 0/3] mllib: Various fixes and changes to Getopt module.
v1 -> v2:
 - Further fixes to Getopt int parsing.
 - Completed the L/S changes.
 - Fixed the test suite so it passes now.  Also we don't need the
   special-case tests for 64 bit arch.
Rich.
2016 Jul 18
3
[PATCH v4 0/2] mllib: Various fixes and changes to Getopt module.
v3 -> v4:
 - Pushed the first patch upstream since it was ACKed.
 - Prevent use of M except for the special virt-v2v options.
 - Sort the options after added --help etc.
 - Make corresponding fixes to the tests.
Rich.
2016 Jul 18
4
[PATCH v3 0/3] mllib: Various fixes and changes to Getopt module.
v2 -> v3:
 - Add M variant and test it.
Rich.