1 |
douglas |
713 |
// Command |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#include <cxx/standard.hh> |
8 |
|
|
|
9 |
douglas |
716 |
#include <api/files.hpp> |
10 |
|
|
|
11 |
douglas |
713 |
#include "Command.hpp" |
12 |
|
|
|
13 |
|
|
template <typename Type> |
14 |
|
|
Type CommandRunner::GetProperties(const cse::String &property, const cse::String &target) |
15 |
|
|
{ |
16 |
|
|
Type properties; |
17 |
|
|
_S<ios::Buffer> buffer(client.GetProperty(property, target)); |
18 |
|
|
ext::Buffer property_; |
19 |
|
|
|
20 |
|
|
while (ios::ReadLine(buffer, property_)) |
21 |
|
|
properties.Insert(property_); |
22 |
|
|
|
23 |
|
|
return properties; |
24 |
|
|
} |
25 |
|
|
|
26 |
|
|
template ext::RedBlackSet<cse::String> CommandRunner::GetProperties(const cse::String &properties, const cse::String &target); |
27 |
douglas |
716 |
|
28 |
|
|
cse::String CommandRunner::GetPassword(const api::Path &directory) |
29 |
|
|
{ |
30 |
|
|
api::Path path(directory.GetChild(_B(".GoogleTron.Password"))); |
31 |
|
|
cse::String password; |
32 |
|
|
|
33 |
|
|
if (path.Exists()) |
34 |
|
|
try |
35 |
|
|
{ |
36 |
|
|
_S<api::FileReader> reader(path.GetPath()); |
37 |
|
|
|
38 |
|
|
password = ios::ReadLine(reader); |
39 |
|
|
} |
40 |
|
|
catch (ext::EosException) {} |
41 |
|
|
else |
42 |
|
|
password = ::getpass("Password:"); |
43 |
|
|
|
44 |
|
|
return password; |
45 |
|
|
} |