Method: Fastlane::FastFile#sh
- Defined in:
- fastlane/lib/fastlane/fast_file.rb
#sh(*args, &b) ⇒ Object
Execute shell command Accepts arguments with and without the command named keyword so that sh behaves like other actions with named keywords github.com/fastlane/fastlane/issues/14930
Example:
sh("ls")
sh("ls", log: false)
sh(command: "ls")
sh(command: "ls", step_name: "listing the files")
sh(command: "ls", log: false)
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'fastlane/lib/fastlane/fast_file.rb', line 200 def sh(*args, &b) # First accepts hash (or named keywords) like other actions # Otherwise uses sh method that doesn't have an interface like an action if args.count == 1 && args.first.kind_of?(Hash) = args.first command = .delete(:command) raise ArgumentError, "sh requires :command keyword in argument" if command.nil? log = [:log].nil? ? true : [:log] FastFile.sh(*command, step_name: [:step_name], log: log, error_callback: [:error_callback], &b) elsif args.count != 1 && args.last.kind_of?(Hash) new_args = args.dup = new_args.pop log = [:log].nil? ? true : [:log] FastFile.sh(*new_args, step_name: [:step_name], log: log, error_callback: [:error_callback], &b) else FastFile.sh(*args, &b) end end |