-
Notifications
You must be signed in to change notification settings - Fork 2.2k
(PUP-12058) Add task to generate man (as markdown) reference #9464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
layout: default | ||
built_from_commit: <%= sha %> | ||
title: Built-in function reference | ||
canonical: "/puppet/latest/function.html" | ||
toc_levels: 2 | ||
toc: columns | ||
--- | ||
|
||
# Built-in function reference | ||
|
||
> **NOTE:** This page was generated from the Puppet source code on <%= now %> | ||
|
||
|
||
|
||
This page is a list of Puppet's built-in functions, with descriptions of what they do and how to use them. | ||
|
||
Functions are plugins you can call during catalog compilation. A call to any function is an expression that resolves to a value. For more information on how to call functions, see [the language reference page about function calls.](lang_functions.dita) | ||
|
||
Many of these function descriptions include auto-detected _signatures,_ which are short reminders of the function's allowed arguments. These signatures aren't identical to the syntax you use to call the function; instead, they resemble a parameter list from a Puppet [class](lang_classes.dita), [defined resource type](lang_defined_types.dita), [function](lang_write_functions_in_puppet.dita), or [lambda](lang_lambdas.dita). The syntax of a signature is: | ||
|
||
``` | ||
<FUNCTION NAME>(<DATA TYPE> <ARGUMENT NAME>, ...) | ||
``` | ||
|
||
The `<DATA TYPE>` is a [Puppet data type value](lang_data_type.dita), like `String` or `Optional[Array[String]]`. The `<ARGUMENT NAME>` is a descriptive name chosen by the function's author to indicate what the argument is used for. | ||
|
||
* Any arguments with an `Optional` data type can be omitted from the function call. | ||
* Arguments that start with an asterisk (like `*$values`) can be repeated any number of times. | ||
* Arguments that start with an ampersand (like `&$block`) aren't normal arguments; they represent a code block, provided with [Puppet's lambda syntax.](lang_lambdas.dita) | ||
|
||
## `undef` values in Puppet 6 | ||
|
||
In Puppet 6, many Puppet types were moved out of the Puppet codebase, and into modules on the Puppet Forge. The new functions handle `undef` values more strictly than their stdlib counterparts. In Puppet 6, code that relies on `undef` values being implicitly treated as other types will return an evaluation error. For more information on which types were moved into modules, see the [Puppet 6 release notes](https://puppet.com/docs/puppet/6.0/release_notes_puppet.html#select-types-moved-to-modules). | ||
|
||
|
||
<%= body %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<% functions.sort{|a,b| a['name'] <=> b['name'] }.each do |func| -%> | ||
## `<%= func['name'] %>` | ||
|
||
<%= func['docstring']['text'] %> | ||
|
||
<% func_signatures = func['signatures'] | ||
multiple_signatures = func_signatures.count > 1 | ||
if func_signatures | ||
func['signatures'].each_with_index do |signature, index| -%> | ||
|
||
<% if multiple_signatures -%> | ||
Signature <%= index+1 %> | ||
|
||
<% end -%> | ||
`<%= signature['signature'] %>` | ||
<% has_parameters = signature.dig('docstring', 'tags')&.detect {|tag| tag['tag_name'] == 'param' && tag['text'] != '' && tag['text'] != nil } || false | ||
if has_parameters -%> | ||
|
||
### Parameters | ||
|
||
<% signature['docstring']['tags'].select {|tag| tag['tag_name'] == 'param' && tag['text'] != '' && tag['text'] != nil}.each do |param| -%> | ||
|
||
* `<%= param['name'] %>` --- <%= param['text'] %> | ||
<% end # each param | ||
|
||
return_types = signature['docstring']['tags'].detect {|tag| tag['tag_name'] == 'return'} | ||
if return_types -%> | ||
|
||
Return type(s): <%= return_types['types'].map {|t| "`#{t}`"}.join(', ') %>. <%= return_types['text'] %> | ||
<% end # if return_types | ||
has_examples = signature['docstring']['tags'].detect {|tag| tag['tag_name'] == 'example' && tag['text'] != '' && tag['text'] != nil } | ||
if has_examples %> | ||
|
||
### Examples | ||
|
||
<% signature['docstring']['tags'].select {|tag| tag['tag_name'] == 'example' && tag['text'] != '' && tag['text'] != nil}.each do |example| -%> | ||
<%= example['name'] %> | ||
|
||
<%= example['text'] %> | ||
|
||
<% end # each example | ||
end # if has_examples | ||
end-%> | ||
<% end # each signature | ||
end -%> | ||
|
||
<% end -%> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
layout: default | ||
built_from_commit: <%= sha %> | ||
title: '<%= title %>' | ||
canonical: "<%= canonical %>" | ||
--- | ||
|
||
# <%= title %> | ||
|
||
> **NOTE:** This page was generated from the Puppet source code on <%= now %> | ||
|
||
<%= body %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
layout: default | ||
built_from_commit: <%= sha %> | ||
title: <%= title %> | ||
canonical: "/puppet/latest/man/overview.html" | ||
--- | ||
|
||
# <%= title %> | ||
|
||
> **NOTE:** This page was generated from the Puppet source code on <%= now %> | ||
|
||
|
||
|
||
Puppet's command line tools consist of a single `puppet` binary with many subcommands. The following subcommands are available in this version of Puppet: | ||
|
||
Core Tools | ||
----- | ||
|
||
These subcommands form the core of Puppet's tool set, and every user should understand what they do. | ||
|
||
<% core_apps.each do |app| -%> | ||
- [puppet <%= app %>](<%= app %>.md) | ||
<% end -%> | ||
|
||
|
||
> Note: The `puppet cert` command is available only in Puppet versions prior to 6.0. For 6.0 and later, use the [`puppetserver cert`command](https://puppet.com/docs/puppet/6/puppet_server_ca_cli.html). | ||
|
||
Secondary subcommands | ||
----- | ||
|
||
Many or most users need to use these subcommands at some point, but they aren't needed for daily use the way the core tools are. | ||
|
||
<% occasional_apps.each do |app| -%> | ||
- [puppet <%= app %>](<%= app %>.md) | ||
<% end -%> | ||
|
||
|
||
Niche subcommands | ||
----- | ||
|
||
Most users can ignore these subcommands. They're only useful for certain niche workflows, and most of them are interfaces to Puppet's internal subsystems. | ||
|
||
<% weird_apps.each do |app| -%> | ||
- [puppet <%= app %>](<%= app %>.md) | ||
<% end -%> | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we should skip this now that it's rendered correctly