git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add progress notification messages to upload and upload-offset APIs.
[libguestfs.git]
/
generator
/
generator_fish.ml
diff --git
a/generator/generator_fish.ml
b/generator/generator_fish.ml
index
76b4c7a
..
516c5b1
100644
(file)
--- a/
generator/generator_fish.ml
+++ b/
generator/generator_fish.ml
@@
-76,11
+76,7
@@
let generate_fish_cmds () =
(* List of command_entry structs. *)
List.iter (
fun (name, _, _, flags, _, shortdesc, longdesc) ->
(* List of command_entry structs. *)
List.iter (
fun (name, _, _, flags, _, shortdesc, longdesc) ->
- pr "struct command_entry %s_cmd_entry = {\n" name;
-
let name2 = replace_char name '_' '-' in
let name2 = replace_char name '_' '-' in
- pr " .name = \"%s\",\n" name2;
-
let aliases =
filter_map (function FishAlias n -> Some n | _ -> None) flags in
let describe_alias =
let aliases =
filter_map (function FishAlias n -> Some n | _ -> None) flags in
let describe_alias =
@@
-89,10
+85,16
@@
let generate_fish_cmds () =
(String.concat " or " (List.map (fun s -> "'" ^ s ^ "'") aliases))
else "" in
(String.concat " or " (List.map (fun s -> "'" ^ s ^ "'") aliases))
else "" in
- pr " .shortdesc = \"%s\",\n" shortdesc;
- pr " .podbody = %S,\n"
- ("=head1 DESCRIPTION\n\n" ^ longdesc ^ describe_alias);
+ let pod =
+ sprintf "%s - %s\n\n=head1 DESCRIPTION\n\n%s\n\n%s"
+ name2 shortdesc longdesc describe_alias in
+ let text =
+ String.concat "\n" (pod2text ~trim:false ~discard:false "NAME" pod)
+ ^ "\n" in
+ pr "struct command_entry %s_cmd_entry = {\n" name;
+ pr " .name = \"%s\",\n" name2;
+ pr " .help = \"%s\",\n" (c_quote text);
pr " .run = run_%s\n" name;
pr "};\n";
pr "\n";
pr " .run = run_%s\n" name;
pr "};\n";
pr "\n";
@@
-100,11
+102,7
@@
let generate_fish_cmds () =
List.iter (
fun (name, (_, args, optargs), _, flags, _, shortdesc, longdesc) ->
List.iter (
fun (name, (_, args, optargs), _, flags, _, shortdesc, longdesc) ->
- pr "struct command_entry %s_cmd_entry = {\n" name;
-
let name2 = replace_char name '_' '-' in
let name2 = replace_char name '_' '-' in
- pr " .name = \"%s\",\n" name2;
-
let aliases =
filter_map (function FishAlias n -> Some n | _ -> None) flags in
let aliases =
filter_map (function FishAlias n -> Some n | _ -> None) flags in
@@
-155,12
+153,16
@@
Guestfish will prompt for these separately."
(String.concat " or " (List.map (fun s -> "'" ^ s ^ "'") aliases))
else "" in
(String.concat " or " (List.map (fun s -> "'" ^ s ^ "'") aliases))
else "" in
- pr " .shortdesc = \"%s\",\n" shortdesc;
- pr " .podbody = %S,\n"
- ("=head1 SYNOPSIS\n\n " ^ synopsis ^ "\n\n" ^
- "=head1 DESCRIPTION\n\n" ^
- longdesc ^ warnings ^ describe_alias);
+ let pod =
+ sprintf "%s - %s\n\n=head1 SYNOPSIS\n\n %s\n\n=head1 DESCRIPTION\n\n%s%s%s"
+ name2 shortdesc synopsis longdesc warnings describe_alias in
+ let text =
+ String.concat "\n" (pod2text ~trim:false ~discard:false "NAME" pod)
+ ^ "\n" in
+ pr "struct command_entry %s_cmd_entry = {\n" name;
+ pr " .name = \"%s\",\n" name2;
+ pr " .help = \"%s\",\n" (c_quote text);
pr " .run = run_%s\n" name;
pr "};\n";
pr "\n";
pr " .run = run_%s\n" name;
pr "};\n";
pr "\n";
@@
-189,7
+191,7
@@
Guestfish will prompt for these separately."
pr "\n";
pr " ct = lookup_fish_command (cmd, strlen (cmd));\n";
pr " if (ct) {\n";
pr "\n";
pr " ct = lookup_fish_command (cmd, strlen (cmd));\n";
pr " if (ct) {\n";
- pr "
pod2text (ct->entry->name, ct->entry->shortdesc, ct->entry->podbody
);\n";
+ pr "
fputs (ct->entry->help, stdout
);\n";
pr " return 0;\n";
pr " }\n";
pr " else\n";
pr " return 0;\n";
pr " }\n";
pr " else\n";
@@
-323,6
+325,7
@@
Guestfish will prompt for these separately."
| Bool n -> pr " int %s;\n" n
| Int n -> pr " int %s;\n" n
| Int64 n -> pr " int64_t %s;\n" n
| Bool n -> pr " int %s;\n" n
| Int n -> pr " int %s;\n" n
| Int64 n -> pr " int64_t %s;\n" n
+ | Pointer _ -> assert false
) args;
if optargs <> [] then (
) args;
if optargs <> [] then (
@@
-423,6
+426,7
@@
Guestfish will prompt for these separately."
parse_integer "argv[i++]" "xstrtoll" "long long" "int" range name
| Int64 name ->
parse_integer "argv[i++]" "xstrtoll" "long long" "int64_t" None name
parse_integer "argv[i++]" "xstrtoll" "long long" "int" range name
| Int64 name ->
parse_integer "argv[i++]" "xstrtoll" "long long" "int64_t" None name
+ | Pointer _ -> assert false
) args;
(* Optional arguments are prefixed with <argname>:<value> and
) args;
(* Optional arguments are prefixed with <argname>:<value> and
@@
-506,6
+510,7
@@
Guestfish will prompt for these separately."
pr " free_file_in (%s);\n" name
| StringList name | DeviceList name ->
pr " free_strings (%s);\n" name
pr " free_file_in (%s);\n" name
| StringList name | DeviceList name ->
pr " free_strings (%s);\n" name
+ | Pointer _ -> assert false
) args;
(* Any output flags? *)
) args;
(* Any output flags? *)
@@
-810,6
+815,7
@@
and generate_fish_actions_pod () =
| FileIn n | FileOut n -> pr " (%s|-)" n
| BufferIn n -> pr " %s" n
| Key _ -> () (* keys are entered at a prompt *)
| FileIn n | FileOut n -> pr " (%s|-)" n
| BufferIn n -> pr " %s" n
| Key _ -> () (* keys are entered at a prompt *)
+ | Pointer _ -> assert false
) args;
List.iter (
function
) args;
List.iter (
function
@@
-905,6
+911,8
@@
and generate_fish_prep_options_c () =
generate_header CStyle GPLv2plus;
pr "\
generate_header CStyle GPLv2plus;
pr "\
+#include <stdio.h>
+
#include \"fish.h\"
#include \"prepopts.h\"
#include \"fish.h\"
#include \"prepopts.h\"