Class: Runoff::Commands::Chat
- Defined in:
- lib/runoff/commands/chat.rb
Class Method Summary collapse
-
.process(args, options = {}) ⇒ Object
Public: Exports specified chats.
Methods inherited from Command
get_composition, get_destination, list_chatnames, print_result, try_to_archive
Class Method Details
.process(args, options = {}) ⇒ Object
Public: Exports specified chats.
args - Array containing skype username options - Hash containing user provided options
Examples
Chat.process ['username'], { from: '~/main.db' }
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/runoff/commands/chat.rb', line 12 def self.process(args, = {}) if args.empty? && !.has_key?('from') raise ArgumentError.new 'You must specify a username or a --from option' end composition = self.get_composition args[0], [:from] destination = self.get_destination [:destination] chatnames, raw_chatnames = composition.get_chatnames self.list_chatnames chatnames indecies = ask 'Which chats do you want to export? (Enter indecies) ', Array indecies = indecies.map { |index| index.to_i } selected_chatnames = [] indecies.each { |index| selected_chatnames << raw_chatnames[index] } self.print_result composition.export_chats(selected_chatnames, destination) self.try_to_archive destination, rescue ArgumentError => e puts e rescue IOError => e puts e end |