login.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. // Generated by IcedCoffeeScript 1.7.1-c
  2. (function() {
  3. var ArgumentParser, Base, Command, KeyPull, PackageJson, add_option_dict, iced, log, session, __iced_k, __iced_k_noop,
  4. __hasProp = {}.hasOwnProperty,
  5. __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
  6. iced = require('iced-runtime').iced;
  7. __iced_k = __iced_k_noop = function() {};
  8. Base = require('./base').Base;
  9. log = require('../log');
  10. ArgumentParser = require('argparse').ArgumentParser;
  11. add_option_dict = require('./argparse').add_option_dict;
  12. PackageJson = require('../package').PackageJson;
  13. session = require('../session').session;
  14. KeyPull = require('../keypull').KeyPull;
  15. exports.Command = Command = (function(_super) {
  16. __extends(Command, _super);
  17. function Command() {
  18. return Command.__super__.constructor.apply(this, arguments);
  19. }
  20. Command.prototype.OPTS = {
  21. P: {
  22. alias: "no-key-pull",
  23. action: "storeTrue",
  24. help: "don't pull secret key from server"
  25. }
  26. };
  27. Command.prototype.use_session = function() {
  28. return true;
  29. };
  30. Command.prototype.needs_cookies = function() {
  31. return true;
  32. };
  33. Command.prototype.add_subcommand_parser = function(scp) {
  34. var name, opts, sub;
  35. opts = {
  36. help: "establish a session"
  37. };
  38. name = "login";
  39. sub = scp.addParser(name, opts);
  40. add_option_dict(sub, this.OPTS);
  41. return [name];
  42. };
  43. Command.prototype.run = function(cb) {
  44. var err, kp, ___iced_passed_deferral, __iced_deferrals, __iced_k;
  45. __iced_k = __iced_k_noop;
  46. ___iced_passed_deferral = iced.findDeferral(arguments);
  47. (function(_this) {
  48. return (function(__iced_k) {
  49. __iced_deferrals = new iced.Deferrals(__iced_k, {
  50. parent: ___iced_passed_deferral,
  51. filename: "/home/max/src/keybase/node-client/src/command/login.iced",
  52. funcname: "Command.run"
  53. });
  54. session.login(__iced_deferrals.defer({
  55. assign_fn: (function() {
  56. return function() {
  57. return err = arguments[0];
  58. };
  59. })(),
  60. lineno: 38
  61. }));
  62. __iced_deferrals._fulfill();
  63. });
  64. })(this)((function(_this) {
  65. return function() {
  66. (function(__iced_k) {
  67. if (!(typeof err !== "undefined" && err !== null) && !_this.argv.no_key_pull) {
  68. kp = new KeyPull({
  69. force: false
  70. });
  71. (function(__iced_k) {
  72. __iced_deferrals = new iced.Deferrals(__iced_k, {
  73. parent: ___iced_passed_deferral,
  74. filename: "/home/max/src/keybase/node-client/src/command/login.iced",
  75. funcname: "Command.run"
  76. });
  77. kp.run(__iced_deferrals.defer({
  78. assign_fn: (function() {
  79. return function() {
  80. return err = arguments[0];
  81. };
  82. })(),
  83. lineno: 41
  84. }));
  85. __iced_deferrals._fulfill();
  86. })(__iced_k);
  87. } else {
  88. return __iced_k();
  89. }
  90. })(function() {
  91. return cb(err);
  92. });
  93. };
  94. })(this));
  95. };
  96. return Command;
  97. })(Base);
  98. }).call(this);