lib/doggy/cli/edit.rb in doggy-2.0.21 vs lib/doggy/cli/edit.rb in doggy-2.0.22
- old
+ new
@@ -42,11 +42,10 @@
def resource_by_param
resources = Doggy::Models::Dashboard.all_local
resources += Doggy::Models::Monitor.all_local
resources += Doggy::Models::Screen.all_local
-
if @param =~ /^[0-9]+$/ then
id = @param.to_i
return resources.find { |res| res.id == id }
elsif @param =~ /^http/ then
id = case @param
@@ -55,10 +54,10 @@
when /com\/monitors/ then Integer(@param[/monitors#(\d+)/i, 1])
else raise StandardError.new('Unknown resource type, cannot edit.')
end
return resources.find { |res| res.id == id }
else
- full_path = File.expand_path(@param, Doggy.object_root)
+ full_path = File.expand_path(@param.gsub('objects/', ''), Doggy.object_root)
return resources.find { |res| res.path == full_path }
end
end
def wait_for_edit