fastlane/lib/fastlane/actions/clipboard.rb in fastlane-2.118.0.beta.20190315200105 vs fastlane/lib/fastlane/actions/clipboard.rb in fastlane-2.118.0.beta.20190316200016

- old
+ new

@@ -1,12 +1,18 @@ module Fastlane module Actions class ClipboardAction < Action def self.run(params) - UI.message("Storing '#{params[:value]}' in the clipboard 🎨") + value = params[:value] - `echo "#{params[:value]}" | tr -d '\n' | pbcopy` # we don't use `sh`, as the command looks ugly + truncated_value = value[0..800].gsub(/\s\w+\s*$/, '...') + UI.message("Storing '#{truncated_value}' in the clipboard 🎨") + + if FastlaneCore::Helper.mac? + require 'open3' + Open3.popen3('pbcopy') { |input, _, _| input << value } + end end ##################################################### # @!group Documentation ##################################################### @@ -22,10 +28,10 @@ description: "The string that should be copied into the clipboard") ] end def self.authors - ["KrauseFx"] + ["KrauseFx", "joshdholtz"] end def self.is_supported?(platform) true end