lib/shelly/cli/file.rb in shelly-0.4.11 vs lib/shelly/cli/file.rb in shelly-0.4.12
- old
+ new
@@ -12,18 +12,22 @@
desc "list [PATH]", "List files in given path"
def list(path = "/")
app = multiple_clouds(options[:cloud], "file list #{path}")
app.list_files(path)
+ rescue Client::NotFoundException => e
+ say_error e["message"]
rescue Client::ConflictException
say_error "Cloud #{app} wasn't deployed properly. Cannot list files."
end
desc "upload PATH", "Upload files to persistent data storage"
def upload(path)
app = multiple_clouds(options[:cloud], "file upload #{path}")
app.upload(path)
+ rescue Client::NotFoundException => e
+ say_error e["message"]
rescue Client::ConflictException
say_error "Cloud #{app} wasn't deployed properly. Cannot upload files."
end
desc "download [SOURCE_PATH] [DEST_PATH]", "Download files from persistent data storage"
@@ -33,10 +37,12 @@
DEST_PATH - optional destination where files should be saved. By default is current working directory.
}
def download(relative_source = ".", destination = ".")
app = multiple_clouds(options[:cloud], "file download #{relative_source} #{destination}")
app.download(relative_source, destination)
+ rescue Client::NotFoundException => e
+ say_error e["message"]
rescue Client::ConflictException
say_error "Cloud #{app} wasn't deployed properly. Cannot download files."
end
method_option :force, :type => :boolean, :aliases => "-f",
@@ -49,9 +55,11 @@
question = "Do you want to permanently delete #{path} (yes/no):"
exit 1 unless yes?(question)
end
app.delete_file(path)
+ rescue Client::NotFoundException => e
+ say_error e["message"]
rescue Client::ConflictException
say_error "Cloud #{app} wasn't deployed properly. Cannot delete files."
end
no_tasks do