Sha256: dad3d55c64adb78b17ef24f9f3db8fb531962603fc844d1f835234c793142918

Contents?: true

Size: 1.34 KB

Versions: 295

Compression:

Stored size: 1.34 KB

Contents

module Fastlane
  module Actions
    class ClipboardAction < Action
      def self.run(params)
        value = params[:value]

        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
      #####################################################

      def self.description
        "Copies a given string into the clipboard. Works only on macOS"
      end

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(key: :value,
                                       env_name: "FL_CLIPBOARD_VALUE",
                                       description: "The string that should be copied into the clipboard")
        ]
      end

      def self.authors
        ["KrauseFx", "joshdholtz"]
      end

      def self.is_supported?(platform)
        true
      end

      def self.example_code
        [
          'clipboard(value: "https://docs.fastlane.tools/")',
          'clipboard(value: lane_context[SharedValues::HOCKEY_DOWNLOAD_LINK] || "")'
        ]
      end

      def self.category
        :misc
      end
    end
  end
end

Version data entries

295 entries across 295 versions & 2 rubygems

Version Path
fastlane-2.132.0.beta.20190926200023 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.132.0.beta.20190925200108 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.132.0.beta.20190924200030 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.132.0.beta.20190923200017 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.132.0.beta.20190922200014 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.132.0.beta.20190921200021 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.132.0.beta.20190920200012 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.132.0.beta.20190919200100 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.132.0.beta.20190918200023 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.132.0.beta.20190917200011 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.132.0.beta.20190916200055 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.132.0.beta.20190915200038 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.132.0.beta.20190914200034 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.132.0.beta.20190913200058 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.132.0.beta.20190912200052 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.131.0 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.131.0.beta.20190911200010 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.131.0.beta.20190910200104 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.131.0.beta.20190909200058 fastlane/lib/fastlane/actions/clipboard.rb
fastlane-2.131.0.beta.20190908200041 fastlane/lib/fastlane/actions/clipboard.rb