13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/pb/cli/device.rb', line 13
def list( help = "" )
unless help.empty?
if "help" == help
invoke( :help, [ "list" ] );
exit 0
else
self.class.handle_argument_error
exit 1
end
end
url = "https://api.pushbullet.com/v2/devices?active=true"
token = Utils::get_token( options )
cols = [ 'iden', 'nickname', 'created' ]
unless options[:fields].nil?
unless options[:fields].empty?
cols = options[:fields].split( /\s*,\s*/ )
end
end
result = Utils::send( url, token, "get" )
Utils::print( {
:format => options[:format],
:cols => cols,
:rows => result['devices'],
} )
end
|