lib/ayadn/alias.rb in ayadn-1.2.8 vs lib/ayadn/alias.rb in ayadn-1.2.9
- old
+ new
@@ -8,12 +8,11 @@
begin
init
unless args.empty?
channel, channel_alias = args[0], args[1]
else
- puts Status.wrong_arguments
- exit
+ Action.quit Status.wrong_arguments
end
if channel.is_integer?
Databases.create_alias(channel, channel_alias)
Logs.rec.info "Added alias '#{channel_alias}' for channel #{channel}."
puts Status.done
@@ -35,12 +34,11 @@
unless args.empty?
Databases.delete_alias(args[0])
Logs.rec.info "Deleted alias '#{args[0]}'."
puts Status.done
else
- puts Status.wrong_arguments
- exit
+ Action.quit Status.wrong_arguments
end
rescue => e
Errors.global_error("alias/delete", args, e)
ensure
Databases.close_all
@@ -53,12 +51,11 @@
begin
init
unless database.nil?
new_db = File.realpath(database)
else
- puts Status.wrong_arguments
- exit
+ Action.quit Status.wrong_arguments
end
if File.exist?(new_db)
Databases.import_aliases(new_db)
Logs.rec.info "Imported '#{new_db}' values in aliases database."
puts Status.done
@@ -83,12 +80,10 @@
if options[:raw]
h = {}
list.each {|k,v| h[k] = v}
puts h.to_json
else
- puts "\e[H\e[2J"
- puts Workers.new.build_aliases_list(list)
- puts "\n"
+ View.new.page Workers.new.build_aliases_list(list)
end
else
puts Status.empty_list
end
rescue => e