Mercurial > repos > other > Puppet
annotate modules/stdlib/lib/puppet/parser/functions/shell_split.rb @ 275:d9352a684e62
Mass update of modules to remove deprecation warnings
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 26 Jan 2020 11:36:07 +0000 |
parents | c42fb28cff86 |
children | adf6fe9bbc17 |
rev | line source |
---|---|
272 | 1 require 'shellwords' |
2 # | |
3 # shell_split.rb | |
4 # | |
5 module Puppet::Parser::Functions | |
6 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
|
7 @summary |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
8 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
|
9 |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
10 @return |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
11 array of tokens |
272 | 12 |
13 This function behaves the same as ruby's Shellwords.shellsplit() function | |
14 DOC | |
15 ) do |arguments| | |
16 | |
17 raise(Puppet::ParseError, "shell_split(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1 | |
18 | |
19 string = arguments[0].to_s | |
20 | |
21 result = Shellwords.shellsplit(string) | |
22 | |
23 return result | |
24 end | |
25 end | |
26 | |
27 # vim: set ts=2 sw=2 et : |