1 const GLib = imports.gi.GLib;
3 const File = imports.File.File;
7 * var cfg = Netrc.forHost('www.google.com');
8 * var uname = cfg.login
9 * var pass = cfg.password
15 forHost: function(name)
18 return this._data[name];
20 throw "Host " + name + " was not found in netrc file (or parser could not read file..)\n";
27 * private - called at the bottom..
32 var netrc = File.read(GLib.get_home_dir() + "/.netrc");
34 netrc.split("\n").forEach(function(nl) {
38 nl.replace(/\s+$/,'').replace(/^\s+/,'').split(/\s+/).forEach(function(kv) {
48 authdata[line.machine] = line;
51 this._data = authdata;