Skip to content

Commit 3be398c

Browse files
Jorge Vidallpil
authored andcommitted
classheader and defheader using puppet strings (honza#1031)
* classheader and defheader using puppet strings * Begin dollar in parameters
1 parent 1b24221 commit 3be398c

File tree

1 file changed

+34
-61
lines changed

1 file changed

+34
-61
lines changed

snippets/puppet.snippets

Lines changed: 34 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,60 @@
11
# Snippets for use with VIM and http://www.vim.org/scripts/script.php?script_id=2540
22
#
3-
# Please contact R.I.Pienaar <[email protected]> for additions and feedback,
3+
# Please contact Jorge Vidal <[email protected]> for additions and feedback,
44
# 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]>
56

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
79
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}
912
#
10-
# ${2:Full description of class $1 here}
13+
# @summary ${3:A short summary of the purpose of this class}
1114
#
12-
# === Parameters
15+
# @param ${4:parameter1} [${5:String}]
16+
# ${6:Explanation of what this parameter affects.}
1317
#
14-
# Document parameters here.
18+
# @example Simple use
19+
# class { '$1': }
1520
#
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+
# }
3825
#
39-
# === Copyright
26+
# @author ${8:`g:snips_author`} <${9:`g:snips_email`}>
4027
#
41-
# Copyright `strftime("%Y")` `g:snips_author`
28+
# @note Copyright `strftime("%Y")` $8
4229
#
43-
class $1 (${3}){
44-
${4}
30+
class $1(
31+
$$4 = undef,
32+
) {
33+
${0}
4534
}
4635

4736
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}
4939
#
50-
# ${2:Full description of defined resource type $1 here}
40+
# @summary ${3:A short summary of the purpose of this define}
5141
#
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.}
7044
#
45+
# @example Simple use
7146
# $1 { 'namevar':
72-
# basedir => '/tmp/src',
47+
# $$4 => '${7:undef}',
7348
# }
7449
#
75-
# === Authors
76-
#
77-
# `g:snips_author` <`g:snips_email`>
50+
# @author ${8:`g:snips_author`} <${9:`g:snips_email`}>
7851
#
79-
# === Copyright
52+
# @note Copyright `strftime("%Y")` $8
8053
#
81-
# Copyright `strftime("%Y")` `g:snips_author`
82-
#
83-
define $1(${3}) {
84-
${4}
54+
define $1(
55+
$$4 = undef,
56+
) {
57+
${0}
8558
}
8659

8760
# Language Constructs

0 commit comments

Comments
 (0)