summaryrefslogtreecommitdiffstats
path: root/lib/hcl.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/hcl.rb')
-rw-r--r--lib/hcl.rb27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/hcl.rb b/lib/hcl.rb
index f5889ab..e045328 100644
--- a/lib/hcl.rb
+++ b/lib/hcl.rb
@@ -39,21 +39,26 @@ class HCl
end
def run
- if @command
- if respond_to? @command
- result = send @command, *@args
- if not result.nil?
- if result.respond_to? :to_a
- puts result.to_a.join(', ')
- elsif result.respond_to? :to_s
- puts result
+ begin
+ if @command
+ if respond_to? @command
+ result = send @command, *@args
+ if not result.nil?
+ if result.respond_to? :to_a
+ puts result.to_a.join(', ')
+ elsif result.respond_to? :to_s
+ puts result
+ end
end
+ else
+ raise UnknownCommand, "unrecognized command `#{@command}'"
end
else
- raise UnknownCommand, "unrecognized command `#{@command}'"
+ show
end
- else
- show
+ rescue TimesheetResource::Failure => e
+ puts "Internal failure. #{e}"
+ exit 1
end
end