mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
doc: add info on per-function needed feature
Document which feature, if any, is needed for a function; this should help users in properly checking feature availability when using certain functions.
This commit is contained in:
@@ -303,6 +303,12 @@ I<The caller must free the returned buffer after use>.\n\n"
|
||||
pr "This function takes a key or passphrase parameter which
|
||||
could contain sensitive material. Read the section
|
||||
L</KEYS AND PASSPHRASES> for more information.\n\n";
|
||||
(match f.optional with
|
||||
| None -> ()
|
||||
| Some opt ->
|
||||
pr "This function depends on the feature C<%s>. See also
|
||||
L</guestfs_feature_available>.\n\n" opt
|
||||
);
|
||||
(match version_added f with
|
||||
| Some version -> pr "(Added in %s)\n\n" version
|
||||
| None -> assert false
|
||||
|
||||
@@ -897,9 +897,17 @@ Guestfish will prompt for these separately.\n\n";
|
||||
if f.protocol_limit_warning then
|
||||
pr "%s\n\n" protocol_limit_warning;
|
||||
|
||||
match deprecation_notice ~replace_underscores:true f with
|
||||
(match deprecation_notice ~replace_underscores:true f with
|
||||
| None -> ()
|
||||
| Some txt -> pr "%s\n\n" txt
|
||||
);
|
||||
|
||||
(match f.optional with
|
||||
| None -> ()
|
||||
| Some opt ->
|
||||
pr "This command depends on the feature C<%s>. See also
|
||||
L</feature-available>.\n\n" opt
|
||||
);
|
||||
) fishdoc_functions_sorted
|
||||
|
||||
(* Generate documentation for guestfish-only commands. *)
|
||||
|
||||
@@ -1081,6 +1081,14 @@ guestfs_session_close (GuestfsSession *session, GError **err)
|
||||
pr " *\n";
|
||||
pr " * %s\n" doc;
|
||||
|
||||
(match f.optional with
|
||||
| None -> ()
|
||||
| Some opt ->
|
||||
pr " * This function depends on the feature \"%s\".\n" opt;
|
||||
pr " * See also guestfs_session_feature_available().\n";
|
||||
pr " *\n";
|
||||
);
|
||||
|
||||
pr " * Returns: ";
|
||||
(match ret with
|
||||
| RErr ->
|
||||
|
||||
@@ -274,6 +274,13 @@ public class GuestFS {
|
||||
pr " * %s\n" f.shortdesc;
|
||||
pr " * </p><p>\n";
|
||||
pr " * %s\n" doc;
|
||||
(match f.optional with
|
||||
| None -> ()
|
||||
| Some opt ->
|
||||
pr " * </p><p>\n";
|
||||
pr " * This function depends on the feature \"%s\". See also {@link #feature_available}.\n"
|
||||
opt;
|
||||
);
|
||||
pr " * </p>\n";
|
||||
(match version_added f with
|
||||
| None -> ()
|
||||
|
||||
@@ -177,6 +177,13 @@ end
|
||||
else
|
||||
pr "%s(** alias for {!%s}" indent f.name;
|
||||
|
||||
(match f.optional with
|
||||
| None -> ()
|
||||
| Some opt ->
|
||||
has_tags := true;
|
||||
pr "\n\n This function depends on the feature \"%s\". See also {!feature_available}."
|
||||
opt
|
||||
);
|
||||
(match f.deprecated_by with
|
||||
| None -> ()
|
||||
| Some replacement ->
|
||||
|
||||
@@ -895,6 +895,12 @@ errnos:
|
||||
pr "%s\n\n" longdesc;
|
||||
if f.protocol_limit_warning then
|
||||
pr "%s\n\n" protocol_limit_warning;
|
||||
(match f.optional with
|
||||
| None -> ()
|
||||
| Some opt ->
|
||||
pr "This function depends on the feature C<%s>. See also
|
||||
C<$g-E<gt>feature-available>.\n\n" opt
|
||||
);
|
||||
(match deprecation_notice f with
|
||||
| None -> ()
|
||||
| Some txt -> pr "%s\n\n" txt
|
||||
|
||||
@@ -817,6 +817,11 @@ class GuestFS(object):
|
||||
match deprecation_notice f with
|
||||
| None -> doc
|
||||
| Some txt -> doc ^ "\n\n" ^ txt in
|
||||
let doc =
|
||||
match f.optional with
|
||||
| None -> doc
|
||||
| Some opt ->
|
||||
doc ^ sprintf "\n\nThis function depends on the feature C<%s>. See also C<g.feature-available>." opt in
|
||||
let doc = pod2text ~width:60 f.name doc in
|
||||
let doc = List.map (fun line -> replace_str line "\\" "\\\\") doc in
|
||||
let doc = String.concat "\n " doc in
|
||||
|
||||
@@ -481,6 +481,11 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
|
||||
| { deprecated_by = None } -> doc
|
||||
| { deprecated_by = Some alt } ->
|
||||
doc ^ (sprintf "\n *\n * [Deprecated] In new code, use rdoc-ref:%s instead." alt) in
|
||||
let doc =
|
||||
match f.optional with
|
||||
| None -> doc
|
||||
| Some opt ->
|
||||
doc ^ sprintf "\n *\n * [Feature] This function depends on the feature +%s+. See also {#feature_available}[rdoc-ref:feature_available]." opt in
|
||||
|
||||
(* Because Ruby documentation appears as C comments, we must
|
||||
* replace any instance of "/*".
|
||||
|
||||
Reference in New Issue
Block a user