class Fastlane::Actions::ClipboardAction

Public Class Methods

authors() click to toggle source
# File fastlane/lib/fastlane/actions/clipboard.rb, line 32
def self.authors
  ["KrauseFx", "joshdholtz"]
end
available_options() click to toggle source
# File fastlane/lib/fastlane/actions/clipboard.rb, line 24
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
category() click to toggle source
# File fastlane/lib/fastlane/actions/clipboard.rb, line 47
def self.category
  :misc
end
description() click to toggle source

@!group Documentation

# File fastlane/lib/fastlane/actions/clipboard.rb, line 20
def self.description
  "Copies a given string into the clipboard. Works only on macOS"
end
example_code() click to toggle source
# File fastlane/lib/fastlane/actions/clipboard.rb, line 40
def self.example_code
  [
    'clipboard(value: "https://docs.fastlane.tools/")',
    'clipboard(value: lane_context[SharedValues::HOCKEY_DOWNLOAD_LINK] || "")'
  ]
end
is_supported?(platform) click to toggle source
# File fastlane/lib/fastlane/actions/clipboard.rb, line 36
def self.is_supported?(platform)
  true
end
run(params) click to toggle source
# File fastlane/lib/fastlane/actions/clipboard.rb, line 4
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