Cask: output files requiring sudo to console

This commit is contained in:
L. E. Segovia 2019-10-02 13:36:05 +00:00
parent aa85bec73e
commit b9a3884ebf
No known key found for this signature in database
GPG Key ID: D5D1DC48B52B7AD5

View File

@ -362,9 +362,13 @@ module Cask
def trash_paths(*paths, command: nil, **_) def trash_paths(*paths, command: nil, **_)
return if paths.empty? return if paths.empty?
raise CaskError, "Some files cannot be moved to the user's Trash." unless paths.all?(&:writable?) trashable, untrashable = paths.split(&:writable?)
unless untrashable.empty?
opoo "These files cannot be moved to the user's Trash: "
puts untrashable
end
result = command.run!("/usr/bin/swift", args: [TRASH_SCRIPT, *paths]) result = command.run!("/usr/bin/swift", args: [TRASH_SCRIPT, *trashable])
# Remove AppleScript's automatic newline. # Remove AppleScript's automatic newline.
result.tap { |r| r.stdout.sub!(/\n$/, "") } result.tap { |r| r.stdout.sub!(/\n$/, "") }