Class: Fastlane::Actions::ClipboardAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/clipboard.rb

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, details, lane_context, method_missing, other_action, output, return_value, sample_return_value, sh, step_text

Class Method Details

.authorsObject



26
27
28
# File 'lib/fastlane/actions/clipboard.rb', line 26

def self.authors
  ["KrauseFx"]
end

.available_optionsObject



18
19
20
21
22
23
24
# File 'lib/fastlane/actions/clipboard.rb', line 18

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

.categoryObject



41
42
43
# File 'lib/fastlane/actions/clipboard.rb', line 41

def self.category
  :misc
end

.descriptionObject



14
15
16
# File 'lib/fastlane/actions/clipboard.rb', line 14

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

.example_codeObject



34
35
36
37
38
39
# File 'lib/fastlane/actions/clipboard.rb', line 34

def self.example_code
  [
    'clipboard(value: "https://github.com/fastlane/fastlane/tree/master/fastlane")',
    'clipboard(value: lane_context[SharedValues::HOCKEY_DOWNLOAD_LINK] || "")'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/fastlane/actions/clipboard.rb', line 30

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



4
5
6
7
8
# File 'lib/fastlane/actions/clipboard.rb', line 4

def self.run(params)
  UI.message("Storing '#{params[:value]}' in the clipboard 🎨")

  `echo "#{params[:value]}" | tr -d '\n' | pbcopy` # we don't use `sh`, as the command looks ugly
end