Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / lib / puppet / parser / functions / shell_split.rb
1 require 'shellwords'
2 #
3 # shell_split.rb
4 #
5 module Puppet::Parser::Functions
6   newfunction(:shell_split, :type => :rvalue, :doc => <<-DOC
7     Splits a string into an array of tokens in the same way the Bourne shell does.
8
9     This function behaves the same as ruby's Shellwords.shellsplit() function
10   DOC
11              ) do |arguments|
12
13     raise(Puppet::ParseError, "shell_split(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
14
15     string = arguments[0].to_s
16
17     result = Shellwords.shellsplit(string)
18
19     return result
20   end
21 end
22
23 # vim: set ts=2 sw=2 et :