|
1 | 1 | # Snippets for use with VIM and http://www.vim.org/scripts/script.php?script_id=2540 |
2 | 2 | # |
3 | | -# Please contact R.I.Pienaar <[email protected]> for additions and feedback, |
| 3 | +# Please contact Jorge Vidal <[email protected]> for additions and feedback, |
4 | 4 | # see it in action @ http://www.devco.net/archives/2009/09/22/vim_and_puppet.php |
| 5 | +# Many thanks to the original author R.I.Pienaar <[email protected]> |
5 | 6 |
|
6 | | -# Header to match http://docs.puppetlabs.com/guides/style_guide.html#puppet-doc |
| 7 | +# Header using Puppet Strings (YARD tags) https://puppet.com/docs/puppet/latest/modules_documentation.html |
| 8 | +# More info: https://github.com/puppetlabs/puppet-strings |
7 | 9 | snippet classheader |
8 | | - # == Class: ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:h:h'), 'name')`} |
| 10 | + # ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:h:h'), 'class-name')`} |
| 11 | + # ${2:A description of what this class does} |
9 | 12 | # |
10 | | - # ${2:Full description of class $1 here} |
| 13 | + # @summary ${3:A short summary of the purpose of this class} |
11 | 14 | # |
12 | | - # === Parameters |
| 15 | + # @param ${4:parameter1} [${5:String}] |
| 16 | + # ${6:Explanation of what this parameter affects.} |
13 | 17 | # |
14 | | - # Document parameters here. |
| 18 | + # @example Simple use |
| 19 | + # class { '$1': } |
15 | 20 | # |
16 | | - # [*parameter1*] |
17 | | - # Explanation of what this parameter affects and what it defaults to. |
18 | | - # e.g. "Specify one or more upstream ntp servers as an array." |
19 | | - # |
20 | | - # === Variables |
21 | | - # |
22 | | - # Here you should define a list of variables that this module would require. |
23 | | - # |
24 | | - # [*variable1*] |
25 | | - # Explanation of how this variable affects the funtion of this class and |
26 | | - # if it has a default. e.g. "The parameter enc_ntp_servers must be set by the |
27 | | - # External Node Classifier as a comma separated list of hostnames." |
28 | | - # |
29 | | - # === Examples |
30 | | - # |
31 | | - # class { '$1': |
32 | | - # parameter1 => [ 'just', 'an', 'example', ] |
33 | | - # } |
34 | | - # |
35 | | - # === Authors |
36 | | - # |
37 | | - # `g:snips_author` <`g:snips_email`> |
| 21 | + # @example Use with params |
| 22 | + # class { '$1': |
| 23 | + # $$4 => '${7:undef}', |
| 24 | + # } |
38 | 25 | # |
39 | | - # === Copyright |
| 26 | + # @author ${8:`g:snips_author`} <${9:`g:snips_email`}> |
40 | 27 | # |
41 | | - # Copyright `strftime("%Y")` `g:snips_author` |
| 28 | + # @note Copyright `strftime("%Y")` $8 |
42 | 29 | # |
43 | | - class $1 (${3}){ |
44 | | - ${4} |
| 30 | + class $1( |
| 31 | + $$4 = undef, |
| 32 | + ) { |
| 33 | + ${0} |
45 | 34 | } |
46 | 35 |
|
47 | 36 | snippet defheader |
48 | | - # == Define: ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:r:s?/manifests/?::?'), 'name')`} |
| 37 | + # ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:h:h'), 'define-name')`} |
| 38 | + # ${2:A description of what this define does} |
49 | 39 | # |
50 | | - # ${2:Full description of defined resource type $1 here} |
| 40 | + # @summary ${3:A short summary of the purpose of this define} |
51 | 41 | # |
52 | | - # === Parameters |
53 | | - # |
54 | | - # Document parameters here |
55 | | - # |
56 | | - # [*namevar*] |
57 | | - # If there is a parameter that defaults to the value of the title string |
58 | | - # when not explicitly set, you must always say so. This parameter can be |
59 | | - # referred to as a "namevar," since it's functionally equivalent to the |
60 | | - # namevar of a core resource type. |
61 | | - # |
62 | | - # [*basedir*] |
63 | | - # Description of this variable. For example, "This parameter sets the |
64 | | - # base directory for this resource type. It should not contain a trailing |
65 | | - # slash." |
66 | | - # |
67 | | - # === Examples |
68 | | - # |
69 | | - # Provide some examples on how to use this type: |
| 42 | + # @param ${4:parameter1} [${5:String}] |
| 43 | + # ${6:Explanation of what this parameter affects.} |
70 | 44 | # |
| 45 | + # @example Simple use |
71 | 46 | # $1 { 'namevar': |
72 | | - # basedir => '/tmp/src', |
| 47 | + # $$4 => '${7:undef}', |
73 | 48 | # } |
74 | 49 | # |
75 | | - # === Authors |
76 | | - # |
77 | | - # `g:snips_author` <`g:snips_email`> |
| 50 | + # @author ${8:`g:snips_author`} <${9:`g:snips_email`}> |
78 | 51 | # |
79 | | - # === Copyright |
| 52 | + # @note Copyright `strftime("%Y")` $8 |
80 | 53 | # |
81 | | - # Copyright `strftime("%Y")` `g:snips_author` |
82 | | - # |
83 | | - define $1(${3}) { |
84 | | - ${4} |
| 54 | + define $1( |
| 55 | + $$4 = undef, |
| 56 | + ) { |
| 57 | + ${0} |
85 | 58 | } |
86 | 59 |
|
87 | 60 | # Language Constructs |
|
0 commit comments