const GLib = imports.gi.GLib;
-const File = imports['../File.js'].File;
-
+const File = imports.File.File;
+/**
+ * usage:
+ * var cfg = Netrc.forHost('www.google.com');
+ * var uname = cfg.login
+ * var pass = cfg.password
+ *
+ *
+ */
Netrc = {
forHost: function(name)
{
- return this.data[name];
- }
+ try {
+ return this._data[name];
+ } catch(e) {
+ throw "Host " + name + " was not found in netrc file (or parser could not read file..)\n";
+ }
+
+ },
_data : {},
/**
authdata[line.machine] = line;
});
- this.data = authdata;
+ this._data = authdata;
- },
+ }
}
-//
+// load the file up.
Netrc._load();
\ No newline at end of file