Mercurial > repos > other > Puppet
annotate modules/stdlib/lib/puppet/parser/functions/shell_split.rb @ 482:d83de9b3a62b default tip
Update hiera.yaml within Puppet config
Forgot that we manage it from here. Now has content to match
new packages
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 30 Aug 2024 16:10:36 +0100 |
parents | adf6fe9bbc17 |
children |
rev | line source |
---|---|
478
adf6fe9bbc17
Update Puppet modules to latest versions
IBBoard <dev@ibboard.co.uk>
parents:
275
diff
changeset
|
1 # frozen_string_literal: true |
adf6fe9bbc17
Update Puppet modules to latest versions
IBBoard <dev@ibboard.co.uk>
parents:
275
diff
changeset
|
2 |
272 | 3 require 'shellwords' |
4 # | |
5 # shell_split.rb | |
6 # | |
7 module Puppet::Parser::Functions | |
478
adf6fe9bbc17
Update Puppet modules to latest versions
IBBoard <dev@ibboard.co.uk>
parents:
275
diff
changeset
|
8 newfunction(:shell_split, type: :rvalue, doc: <<-DOC |
275
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
9 @summary |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
10 Splits a string into an array of tokens in the same way the Bourne shell does. |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
11 |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
12 @return |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
13 array of tokens |
272 | 14 |
15 This function behaves the same as ruby's Shellwords.shellsplit() function | |
16 DOC | |
478
adf6fe9bbc17
Update Puppet modules to latest versions
IBBoard <dev@ibboard.co.uk>
parents:
275
diff
changeset
|
17 ) do |arguments| |
272 | 18 raise(Puppet::ParseError, "shell_split(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1 |
19 | |
20 string = arguments[0].to_s | |
21 | |
22 result = Shellwords.shellsplit(string) | |
23 | |
24 return result | |
25 end | |
26 end | |
27 | |
28 # vim: set ts=2 sw=2 et : |