lib/TokiCLI/app.rb in TokiCLI-0.0.6 vs lib/TokiCLI/app.rb in TokiCLI-0.0.7
- old
+ new
@@ -2,10 +2,22 @@
module TokiCLI
class App < Thor
package_name "TokiCLI"
%w{get_messages search_messages get_channels module status view authorize}.each {|r| require_relative "#{r}"}
+ desc "scan", "Scan /Applications to resolve app names"
+ def scan
+ toki = create_toki(options)
+ bundle_ids = toki.get_bundle_ids
+ path = "#{Dir.home}/.toki_cli"
+ Dir.mkdir path unless Dir.exist? path
+ f = File.new "#{path}/apps.json", "w"
+ f.write bundle_ids.to_json
+ f.close
+ puts "\nDone.\n\n"
+ end
+
desc "total", "Shows the total usage of all apps"
option :adn, aliases: '-a', type: :boolean, desc: 'Select ADN channel as source (toki total -a)'
option :json, aliases: '-j', type: :boolean, desc: 'Export the results as a JSON file'
option :csv, aliases: '-c', type: :boolean, desc: 'Export the results as a CSV file'
def total
@@ -173,9 +185,10 @@
def clear
puts "\e[H\e[2J"
end
def get_all(t, options)
- t.all_data(t.get_content(options))
+ content = t.get_content(options)
+ t.all_data(content)
end
end
end