19 lines
443 B
Ruby
19 lines
443 B
Ruby
# Copyright (c) HashiCorp, Inc.
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
|
|
module Vagrant
|
|
module Util
|
|
module ShellQuote
|
|
# This will auto-escape the text with the given quote mark type.
|
|
#
|
|
# @param [String] text Text to escape
|
|
# @param [String] quote The quote character, such as "
|
|
def self.escape(text, quote)
|
|
text.gsub(/#{quote}/) do |m|
|
|
"#{m}\\#{m}#{m}"
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|