class Fastlane::Actions::GitAddAction
Public Class Methods
available_options()
click to toggle source
# File fastlane/lib/fastlane/actions/git_add.rb, line 47 def self.available_options [ FastlaneCore::ConfigItem.new(key: :path, description: "The file(s) and path(s) you want to add", type: Array, conflicting_options: [:pathspec], optional: true), FastlaneCore::ConfigItem.new(key: :shell_escape, description: "Shell escapes paths (set to false if using wildcards or manually escaping spaces in :path)", type: Boolean, default_value: true, optional: true), FastlaneCore::ConfigItem.new(key: :force, description: "Allow adding otherwise ignored files", type: Boolean, default_value: false, optional: true), # Deprecated FastlaneCore::ConfigItem.new(key: :pathspec, description: "The pathspec you want to add files from", conflicting_options: [:path], optional: true, deprecated: "Use `--path` instead") ] end
category()
click to toggle source
# File fastlane/lib/fastlane/actions/git_add.rb, line 98 def self.category :source_control end
description()
click to toggle source
@!group Documentation
# File fastlane/lib/fastlane/actions/git_add.rb, line 43 def self.description "Directly add the given file or all files" end
example_code()
click to toggle source
# File fastlane/lib/fastlane/actions/git_add.rb, line 85 def self.example_code [ 'git_add', 'git_add(path: "./version.txt")', 'git_add(path: ["./version.txt", "./changelog.txt"])', 'git_add(path: "./Frameworks/*", shell_escape: false)', 'git_add(path: ["*.h", "*.m"], shell_escape: false)', 'git_add(path: "./Frameworks/*", shell_escape: false)', 'git_add(path: "*.txt", shell_escape: false)', 'git_add(path: "./tmp/.keep", force: true)' ] end
is_supported?(platform)
click to toggle source
# File fastlane/lib/fastlane/actions/git_add.rb, line 81 def self.is_supported?(platform) true end
return_value()
click to toggle source
# File fastlane/lib/fastlane/actions/git_add.rb, line 73 def self.return_value nil end
run(params)
click to toggle source
# File fastlane/lib/fastlane/actions/git_add.rb, line 4 def self.run(params) should_escape = params[:shell_escape] if params[:pathspec] paths = params[:pathspec] success_message = "Successfully added from \"#{paths}\" 💾." elsif params[:path] paths = params[:path].map do |p| shell_escape(p, should_escape) end.join(' ') success_message = "Successfully added \"#{paths}\" 💾." else paths = "." success_message = "Successfully added all files 💾." end force = params[:force] ? "--force" : nil command = [ "git", "add", force, paths ].compact result = Actions.sh(command.join(" "), log: FastlaneCore::Globals.verbose?).chomp UI.success(success_message) return result end
shell_escape(path, should_escape)
click to toggle source
# File fastlane/lib/fastlane/actions/git_add.rb, line 34 def self.shell_escape(path, should_escape) path = path.shellescape if should_escape path end