@catladder/cli 0.0.0-test4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/.nvmrc +1 -1
  2. package/bin/catenv +3 -0
  3. package/bin/catladder +1 -1
  4. package/dist/apps/catenv/catenv.d.ts +2 -0
  5. package/dist/apps/catenv/catenv.js +135 -0
  6. package/dist/apps/catenv/catenv.js.map +1 -0
  7. package/dist/apps/cli/cli.d.ts +2 -0
  8. package/dist/apps/cli/cli.js +81 -0
  9. package/dist/apps/cli/cli.js.map +1 -0
  10. package/dist/apps/cli/commands/general/index.d.ts +4 -0
  11. package/dist/apps/cli/commands/general/index.js +274 -0
  12. package/dist/apps/cli/commands/general/index.js.map +1 -0
  13. package/dist/apps/cli/commands/general/namespaceAutoCompletion.d.ts +3 -0
  14. package/dist/apps/cli/commands/general/namespaceAutoCompletion.js +56 -0
  15. package/dist/apps/cli/commands/general/namespaceAutoCompletion.js.map +1 -0
  16. package/dist/apps/cli/commands/general/portForward.d.ts +3 -0
  17. package/dist/apps/cli/commands/general/portForward.js +98 -0
  18. package/dist/apps/cli/commands/general/portForward.js.map +1 -0
  19. package/dist/apps/cli/commands/mongodb/index.d.ts +3 -0
  20. package/dist/apps/cli/commands/mongodb/index.js +53 -0
  21. package/dist/apps/cli/commands/mongodb/index.js.map +1 -0
  22. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +3 -0
  23. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +190 -0
  24. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -0
  25. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +3 -0
  26. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js +96 -0
  27. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js.map +1 -0
  28. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +3 -0
  29. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +105 -0
  30. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -0
  31. package/dist/apps/cli/commands/mongodb/utils/index.d.ts +13 -0
  32. package/dist/apps/cli/commands/mongodb/utils/index.js +167 -0
  33. package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -0
  34. package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +3 -0
  35. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +128 -0
  36. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
  37. package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +3 -0
  38. package/dist/apps/cli/commands/project/commandConfigSecrets.js +254 -0
  39. package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -0
  40. package/dist/apps/cli/commands/project/commandCopyDB.d.ts +3 -0
  41. package/dist/apps/cli/commands/project/commandCopyDB.js +102 -0
  42. package/dist/apps/cli/commands/project/commandCopyDB.js.map +1 -0
  43. package/dist/apps/cli/commands/project/commandDeletePods.d.ts +3 -0
  44. package/dist/apps/cli/commands/project/commandDeletePods.js +119 -0
  45. package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -0
  46. package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +3 -0
  47. package/dist/apps/cli/commands/project/commandDeleteProject.js +97 -0
  48. package/dist/apps/cli/commands/project/commandDeleteProject.js.map +1 -0
  49. package/dist/apps/cli/commands/project/commandEnvVars.d.ts +3 -0
  50. package/dist/apps/cli/commands/project/commandEnvVars.js +74 -0
  51. package/dist/apps/cli/commands/project/commandEnvVars.js.map +1 -0
  52. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +3 -0
  53. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js +58 -0
  54. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +1 -0
  55. package/dist/apps/cli/commands/project/commandGetShell.d.ts +3 -0
  56. package/dist/apps/cli/commands/project/commandGetShell.js +92 -0
  57. package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -0
  58. package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +3 -0
  59. package/dist/apps/cli/commands/project/commandGitlabCi.js +185 -0
  60. package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -0
  61. package/dist/apps/cli/commands/project/commandInitGitlab.d.ts +3 -0
  62. package/dist/apps/cli/commands/project/commandInitGitlab.js +245 -0
  63. package/dist/apps/cli/commands/project/commandInitGitlab.js.map +1 -0
  64. package/dist/apps/cli/commands/project/commandInitProject.d.ts +3 -0
  65. package/dist/apps/cli/commands/project/commandInitProject.js +345 -0
  66. package/dist/apps/cli/commands/project/commandInitProject.js.map +1 -0
  67. package/dist/apps/cli/commands/project/commandListPods.d.ts +3 -0
  68. package/dist/apps/cli/commands/project/commandListPods.js +78 -0
  69. package/dist/apps/cli/commands/project/commandListPods.js.map +1 -0
  70. package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +7 -0
  71. package/dist/apps/cli/commands/project/commandMigrateHelm3.js +113 -0
  72. package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -0
  73. package/dist/apps/cli/commands/project/commandNamespace.d.ts +3 -0
  74. package/dist/apps/cli/commands/project/commandNamespace.js +70 -0
  75. package/dist/apps/cli/commands/project/commandNamespace.js.map +1 -0
  76. package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +3 -0
  77. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +83 -0
  78. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -0
  79. package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +3 -0
  80. package/dist/apps/cli/commands/project/commandOpenDashboard.js +92 -0
  81. package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -0
  82. package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +3 -0
  83. package/dist/apps/cli/commands/project/commandOpenEnv.js +80 -0
  84. package/dist/apps/cli/commands/project/commandOpenEnv.js.map +1 -0
  85. package/dist/apps/cli/commands/project/commandOpenGit.d.ts +3 -0
  86. package/dist/apps/cli/commands/project/commandOpenGit.js +56 -0
  87. package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -0
  88. package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +3 -0
  89. package/dist/apps/cli/commands/project/commandOpenGrafana.js +83 -0
  90. package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -0
  91. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +3 -0
  92. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +99 -0
  93. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -0
  94. package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +3 -0
  95. package/dist/apps/cli/commands/project/commandOpenLogs.js +87 -0
  96. package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -0
  97. package/dist/apps/cli/commands/project/commandPauseProject.d.ts +3 -0
  98. package/dist/apps/cli/commands/project/commandPauseProject.js +97 -0
  99. package/dist/apps/cli/commands/project/commandPauseProject.js.map +1 -0
  100. package/dist/apps/cli/commands/project/commandPortForward.d.ts +3 -0
  101. package/dist/apps/cli/commands/project/commandPortForward.js +106 -0
  102. package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -0
  103. package/dist/apps/cli/commands/project/commandReloadConfig.d.ts +3 -0
  104. package/dist/apps/cli/commands/project/commandReloadConfig.js +62 -0
  105. package/dist/apps/cli/commands/project/commandReloadConfig.js.map +1 -0
  106. package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +3 -0
  107. package/dist/apps/cli/commands/project/commandTriggerCronjob.js +144 -0
  108. package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -0
  109. package/dist/apps/cli/commands/project/index.d.ts +3 -0
  110. package/dist/apps/cli/commands/project/index.js +97 -0
  111. package/dist/apps/cli/commands/project/index.js.map +1 -0
  112. package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +3 -0
  113. package/dist/apps/cli/commands/project/utils/autocompletions.js +96 -0
  114. package/dist/apps/cli/commands/project/utils/autocompletions.js.map +1 -0
  115. package/dist/apps/cli/commands/project/utils/ensureCluster.d.ts +1 -0
  116. package/dist/apps/cli/commands/project/utils/ensureCluster.js +84 -0
  117. package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -0
  118. package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +1 -0
  119. package/dist/apps/cli/commands/project/utils/ensureNamespace.js +92 -0
  120. package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -0
  121. package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +2 -0
  122. package/dist/apps/cli/commands/project/utils/showProjectBanner.js +58 -0
  123. package/dist/apps/cli/commands/project/utils/showProjectBanner.js.map +1 -0
  124. package/dist/apps/cli/commands/shared/index.d.ts +2 -0
  125. package/dist/apps/cli/commands/shared/index.js +72 -0
  126. package/dist/apps/cli/commands/shared/index.js.map +1 -0
  127. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +3 -0
  128. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +131 -0
  129. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -0
  130. package/dist/apps/cli/config/writeConfig.d.ts +5 -0
  131. package/dist/apps/cli/config/writeConfig.js +104 -0
  132. package/dist/apps/cli/config/writeConfig.js.map +1 -0
  133. package/dist/apps/cli/utils/getGoogleAuthUserNumber.d.ts +1 -0
  134. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
  135. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
  136. package/dist/apps/cli/verify/index.d.ts +2 -0
  137. package/dist/apps/cli/verify/index.js +90 -0
  138. package/dist/apps/cli/verify/index.js.map +1 -0
  139. package/dist/apps/cli/verify/migration/fromv2.d.ts +3 -0
  140. package/dist/apps/cli/verify/migration/fromv2.js +322 -0
  141. package/dist/apps/cli/verify/migration/fromv2.js.map +1 -0
  142. package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +4 -0
  143. package/dist/apps/cli/verify/migration/migrateSecrets.js +88 -0
  144. package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -0
  145. package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +17 -0
  146. package/dist/apps/cli/verify/migration/oldGitlabCi.js +26 -0
  147. package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -0
  148. package/dist/catenv.d.ts +1 -0
  149. package/dist/catenv.js +8 -0
  150. package/dist/catenv.js.map +1 -0
  151. package/dist/cli.d.ts +1 -0
  152. package/dist/cli.js +13 -0
  153. package/dist/cli.js.map +1 -0
  154. package/dist/config/clusters.d.ts +14 -0
  155. package/dist/config/clusters.js +72 -0
  156. package/dist/config/clusters.js.map +1 -0
  157. package/dist/config/constants.d.ts +4 -0
  158. package/dist/config/constants.js +8 -0
  159. package/dist/config/constants.js.map +1 -0
  160. package/dist/config/getProjectConfig.d.ts +21 -0
  161. package/dist/config/getProjectConfig.js +212 -0
  162. package/dist/config/getProjectConfig.js.map +1 -0
  163. package/dist/k8sApi/index.d.ts +5 -0
  164. package/dist/k8sApi/index.js +11 -0
  165. package/dist/k8sApi/index.js.map +1 -0
  166. package/dist/packageInfos.d.ts +2 -0
  167. package/dist/packageInfos.js +6 -0
  168. package/dist/packageInfos.js.map +1 -0
  169. package/dist/tsconfig.tsbuildinfo +1 -0
  170. package/dist/types/types.d.ts +18 -0
  171. package/dist/types/types.js +3 -0
  172. package/dist/types/types.js.map +1 -0
  173. package/dist/utils/cluster.d.ts +12 -0
  174. package/dist/utils/cluster.js +100 -0
  175. package/dist/utils/cluster.js.map +1 -0
  176. package/dist/utils/dashboardToken.d.ts +2 -0
  177. package/dist/utils/dashboardToken.js +89 -0
  178. package/dist/utils/dashboardToken.js.map +1 -0
  179. package/dist/utils/editAsFile.d.ts +1 -0
  180. package/dist/utils/editAsFile.js +85 -0
  181. package/dist/utils/editAsFile.js.map +1 -0
  182. package/dist/utils/files.d.ts +2 -0
  183. package/dist/utils/files.js +83 -0
  184. package/dist/utils/files.js.map +1 -0
  185. package/dist/utils/formatEnvVars.d.ts +2 -0
  186. package/dist/utils/formatEnvVars.js +10 -0
  187. package/dist/utils/formatEnvVars.js.map +1 -0
  188. package/dist/utils/getEditor.d.ts +4 -0
  189. package/dist/utils/getEditor.js +70 -0
  190. package/dist/utils/getEditor.js.map +1 -0
  191. package/dist/utils/gitlab.d.ts +21 -0
  192. package/dist/utils/gitlab.js +258 -0
  193. package/dist/utils/gitlab.js.map +1 -0
  194. package/dist/utils/log.d.ts +1 -0
  195. package/dist/utils/log.js +14 -0
  196. package/dist/utils/log.js.map +1 -0
  197. package/dist/utils/passwordstore/index.d.ts +8 -0
  198. package/dist/utils/passwordstore/index.js +378 -0
  199. package/dist/utils/passwordstore/index.js.map +1 -0
  200. package/dist/utils/portForward.d.ts +4 -0
  201. package/dist/utils/portForward.js +116 -0
  202. package/dist/utils/portForward.js.map +1 -0
  203. package/dist/utils/preferences/index.d.ts +3 -0
  204. package/dist/utils/preferences/index.js +119 -0
  205. package/dist/utils/preferences/index.js.map +1 -0
  206. package/dist/utils/projects/index.d.ts +8 -0
  207. package/dist/utils/projects/index.js +150 -0
  208. package/dist/utils/projects/index.js.map +1 -0
  209. package/dist/utils/promise.d.ts +2 -0
  210. package/dist/utils/promise.js +62 -0
  211. package/dist/utils/promise.js.map +1 -0
  212. package/dist/utils/shell.d.ts +1 -0
  213. package/dist/utils/shell.js +81 -0
  214. package/dist/utils/shell.js.map +1 -0
  215. package/package.json +10 -11
  216. package/src/apps/catenv/catenv.ts +48 -27
  217. package/src/apps/{shell/shell.ts → cli/cli.ts} +12 -2
  218. package/src/apps/{shell → cli}/commands/general/index.ts +1 -1
  219. package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
  220. package/src/apps/{shell → cli}/commands/general/portForward.ts +1 -1
  221. package/src/apps/{shell → cli}/commands/mongodb/index.ts +1 -1
  222. package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +18 -18
  223. package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +12 -10
  224. package/src/apps/{shell → cli}/commands/mongodb/projectMongoPortForward.ts +13 -8
  225. package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +9 -8
  226. package/src/apps/{shell → cli}/commands/project/commandCloudSqlProxy.ts +23 -17
  227. package/src/apps/cli/commands/project/commandConfigSecrets.ts +204 -0
  228. package/src/apps/{shell → cli}/commands/project/commandCopyDB.ts +22 -23
  229. package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +8 -9
  230. package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +7 -8
  231. package/src/apps/cli/commands/project/commandEnvVars.ts +15 -0
  232. package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +2 -2
  233. package/src/apps/{shell → cli}/commands/project/commandGetShell.ts +10 -10
  234. package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +1 -1
  235. package/src/apps/cli/commands/project/commandInitGitlab.ts +203 -0
  236. package/src/apps/{shell → cli}/commands/project/commandInitProject.ts +14 -6
  237. package/src/apps/cli/commands/project/commandListPods.ts +18 -0
  238. package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +16 -7
  239. package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
  240. package/src/apps/{shell → cli}/commands/project/commandOpenCostDashboard.ts +10 -7
  241. package/src/apps/cli/commands/project/commandOpenDashboard.ts +45 -0
  242. package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
  243. package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +1 -1
  244. package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +7 -7
  245. package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +9 -10
  246. package/src/apps/{shell → cli}/commands/project/commandOpenLogs.ts +7 -7
  247. package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +9 -7
  248. package/src/apps/{shell → cli}/commands/project/commandPortForward.ts +8 -8
  249. package/src/apps/cli/commands/project/commandReloadConfig.ts +12 -0
  250. package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +7 -7
  251. package/src/apps/{shell → cli}/commands/project/index.ts +4 -3
  252. package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
  253. package/src/apps/cli/commands/project/utils/ensureCluster.ts +37 -0
  254. package/src/apps/{shell → cli}/commands/project/utils/ensureNamespace.ts +2 -3
  255. package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
  256. package/src/apps/{shell → cli}/commands/shared/index.ts +0 -0
  257. package/src/apps/{shell → cli}/commands/theStuffThatReallyMatters/index.ts +11 -11
  258. package/src/apps/cli/config/writeConfig.ts +69 -0
  259. package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
  260. package/src/apps/cli/verify/index.ts +34 -0
  261. package/src/apps/cli/verify/migration/fromv2.ts +242 -0
  262. package/src/apps/cli/verify/migration/migrateSecrets.ts +37 -0
  263. package/src/apps/cli/verify/migration/oldGitlabCi.ts +43 -0
  264. package/src/catenv.ts +3 -0
  265. package/src/cli.ts +8 -0
  266. package/src/config/getProjectConfig.ts +118 -0
  267. package/src/types/types.ts +0 -2
  268. package/src/utils/cluster.ts +15 -2
  269. package/src/utils/editAsFile.ts +31 -0
  270. package/src/utils/files.ts +6 -2
  271. package/src/utils/gitlab.ts +126 -32
  272. package/src/utils/passwordstore/index.ts +19 -21
  273. package/src/utils/preferences/index.ts +6 -3
  274. package/src/utils/projects/index.ts +14 -134
  275. package/tsconfig.json +3 -7
  276. package/bin/catenv.sh +0 -1
  277. package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -245
  278. package/src/apps/shell/commands/project/commandEnvVars.ts +0 -17
  279. package/src/apps/shell/commands/project/commandInitGitlab.ts +0 -157
  280. package/src/apps/shell/commands/project/commandListPods.ts +0 -21
  281. package/src/apps/shell/commands/project/commandNamespace.ts +0 -12
  282. package/src/apps/shell/commands/project/commandOpenDashboard.ts +0 -27
  283. package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
  284. package/src/apps/shell/commands/project/commandVariables.ts +0 -13
  285. package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -7
  286. package/src/apps/shell/commands/project/utils/ensureCluster.ts +0 -31
  287. package/src/apps/shell/commands/project/utils/monorepo.ts +0 -45
  288. package/src/index.ts +0 -17
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 14
1
+ 16
package/bin/catenv ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ // tslint:disable-next-line:no-var-requires
3
+ require("../dist/catenv.js");
package/bin/catladder CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  // tslint:disable-next-line:no-var-requires
3
- require("../dist/index.js");
3
+ require("../dist/cli.js");
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ exports.__esModule = true;
50
+ var getProjectConfig_1 = require("../../config/getProjectConfig");
51
+ var projects_1 = require("../../utils/projects");
52
+ var path_1 = require("path");
53
+ var getCurrentComponentName = function (components) { return __awaiter(void 0, void 0, void 0, function () {
54
+ var gitRoot, currentDir;
55
+ return __generator(this, function (_a) {
56
+ switch (_a.label) {
57
+ case 0: return [4 /*yield*/, (0, projects_1.getGitRoot)()];
58
+ case 1:
59
+ gitRoot = _a.sent();
60
+ currentDir = process.cwd();
61
+ return [2 /*return*/, Object.keys(components).find(function (c) {
62
+ return currentDir.startsWith((0, path_1.join)(gitRoot, components[c].dir));
63
+ })];
64
+ }
65
+ });
66
+ }); };
67
+ var sanitizeEnvVarName = function (name) { return name.replace(/[\s\-.]+/g, "_"); };
68
+ var getAllVariablesToPrint = function (config) { return __awaiter(void 0, void 0, void 0, function () {
69
+ var components, currentComponent, variables;
70
+ return __generator(this, function (_a) {
71
+ switch (_a.label) {
72
+ case 0:
73
+ components = config.components;
74
+ return [4 /*yield*/, getCurrentComponentName(components)];
75
+ case 1:
76
+ currentComponent = _a.sent();
77
+ variables = {};
78
+ if (!currentComponent) return [3 /*break*/, 3];
79
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVars)(null, "local", currentComponent)];
80
+ case 2:
81
+ variables = _a.sent();
82
+ return [3 /*break*/, 5];
83
+ case 3: return [4 /*yield*/, Object.keys(components).reduce(function (acc, componentName) { return __awaiter(void 0, void 0, void 0, function () {
84
+ var subappvars, _a;
85
+ return __generator(this, function (_b) {
86
+ switch (_b.label) {
87
+ case 0: return [4 /*yield*/, (0, getProjectConfig_1.getEnvVars)(null, "local", componentName)];
88
+ case 1:
89
+ subappvars = _b.sent();
90
+ _a = [{}];
91
+ return [4 /*yield*/, acc];
92
+ case 2: return [2 /*return*/, __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_b.sent())])), subappvars]), Object.fromEntries(Object.entries(subappvars).map(function (_a) {
93
+ var key = _a[0], value = _a[1];
94
+ return [
95
+ "".concat(sanitizeEnvVarName(componentName.toUpperCase()), "_").concat(key),
96
+ value,
97
+ ];
98
+ }))])];
99
+ }
100
+ });
101
+ }); }, {})];
102
+ case 4:
103
+ // when in a monorep and not in a subapp, merge all env vars.
104
+ // this is not 100% correct, but better than not exporting any vars at all
105
+ // so we also add prefixed variants
106
+ variables = _a.sent();
107
+ _a.label = 5;
108
+ case 5: return [2 /*return*/, variables];
109
+ }
110
+ });
111
+ }); };
112
+ exports["default"] = (function () { return __awaiter(void 0, void 0, void 0, function () {
113
+ var config, variables;
114
+ return __generator(this, function (_a) {
115
+ switch (_a.label) {
116
+ case 0: return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
117
+ case 1:
118
+ config = _a.sent();
119
+ if (!config) {
120
+ return [2 /*return*/];
121
+ }
122
+ return [4 /*yield*/, getAllVariablesToPrint(config)];
123
+ case 2:
124
+ variables = _a.sent();
125
+ console.log(Object.entries(variables)
126
+ .map(function (_a) {
127
+ var key = _a[0], value = _a[1];
128
+ return "export ".concat(key, "='").concat(value, "'");
129
+ })
130
+ .join("\n"));
131
+ return [2 /*return*/];
132
+ }
133
+ });
134
+ }); });
135
+ //# sourceMappingURL=catenv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catenv.js","sourceRoot":"","sources":["../../../src/apps/catenv/catenv.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kEAA6E;AAC7E,iDAAkD;AAClD,6BAA4B;AAC5B,IAAM,uBAAuB,GAAG,UAC9B,UAA2C;;;;oBAE3B,qBAAM,IAAA,qBAAU,GAAE,EAAA;;gBAA5B,OAAO,GAAG,SAAkB;gBAC5B,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;gBACjC,sBAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,UAAC,CAAC;wBACpC,OAAA,UAAU,CAAC,UAAU,CAAC,IAAA,WAAI,EAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;oBAAvD,CAAuD,CACxD,EAAC;;;KACH,CAAC;AAEF,IAAM,kBAAkB,GAAG,UAAC,IAAY,IAAK,OAAA,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,EAA9B,CAA8B,CAAC;AAE5E,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S,GAAG,SAAoC;gBAEtD,OAAO,CAAC,GAAG,CACT,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;qBACtB,GAAG,CAAC,UAAC,EAAY;wBAAX,GAAG,QAAA,EAAE,KAAK,QAAA;oBAAM,OAAA,iBAAU,GAAG,eAAK,KAAK,MAAG;gBAA1B,CAA0B,CAAC;qBACjD,IAAI,CAAC,IAAI,CAAC,CACd,CAAC;;;;KACH,EAAC"}
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ exports.__esModule = true;
42
+ var vorpal_1 = __importDefault(require("vorpal"));
43
+ // tslint:disable-next-line:no-var-requires
44
+ var packageInfos_1 = __importDefault(require("../../packageInfos"));
45
+ var portForward_1 = require("../../utils/portForward");
46
+ var general_1 = __importDefault(require("./commands/general"));
47
+ var mongodb_1 = __importDefault(require("./commands/mongodb"));
48
+ var project_1 = __importDefault(require("./commands/project"));
49
+ var theStuffThatReallyMatters_1 = __importDefault(require("./commands/theStuffThatReallyMatters"));
50
+ var verify_1 = require("./verify");
51
+ var showProjectBanner_1 = require("./commands/project/utils/showProjectBanner");
52
+ exports["default"] = (function () { return __awaiter(void 0, void 0, void 0, function () {
53
+ var vorpal, welcomeMessage;
54
+ return __generator(this, function (_a) {
55
+ switch (_a.label) {
56
+ case 0:
57
+ vorpal = new vorpal_1["default"]();
58
+ welcomeMessage = "catladder 2022 \uD83D\uDE3B version ".concat(packageInfos_1["default"].version);
59
+ vorpal
60
+ .delimiter("catladder $") // emoji messes with cursor :-( https://github.com/dthree/vorpal/issues/332
61
+ .history("catladder")
62
+ .show()
63
+ .log("")
64
+ .log(welcomeMessage)
65
+ .log("");
66
+ return [4 /*yield*/, (0, showProjectBanner_1.showProjectBanner)(vorpal)];
67
+ case 1:
68
+ _a.sent();
69
+ (0, verify_1.verify)(vorpal);
70
+ (0, general_1["default"])(vorpal);
71
+ (0, project_1["default"])(vorpal);
72
+ (0, mongodb_1["default"])(vorpal);
73
+ (0, theStuffThatReallyMatters_1["default"])(vorpal);
74
+ process.on("exit", function () {
75
+ (0, portForward_1.stopAllPortForwards)();
76
+ });
77
+ return [2 /*return*/];
78
+ }
79
+ });
80
+ }); });
81
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/apps/cli/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA4B;AAE5B,2CAA2C;AAC3C,oEAA8C;AAC9C,uDAA8D;AAC9D,+DAAyC;AACzC,+DAAyC;AACzC,+DAAyC;AACzC,mGAA6E;AAG7E,mCAAkC;AAClC,gFAA+E;AAE/E,sBAAe;;;;;gBACP,MAAM,GAAG,IAAI,mBAAM,EAAE,CAAC;gBAEtB,cAAc,GAAG,8CAA6B,yBAAY,CAAC,OAAO,CAAE,CAAC;gBAE3E,MAAM;qBACH,SAAS,CAAC,aAAa,CAAC,CAAC,2EAA2E;qBACpG,OAAO,CAAC,WAAW,CAAC;qBACpB,IAAI,EAAE;qBACN,GAAG,CAAC,EAAE,CAAC;qBACP,GAAG,CAAC,cAAc,CAAC;qBACnB,GAAG,CAAC,EAAE,CAAC,CAAC;gBAEX,qBAAM,IAAA,qCAAiB,EAAC,MAAM,CAAC,EAAA;;gBAA/B,SAA+B,CAAC;gBAEhC,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC;gBAEf,IAAA,oBAAO,EAAC,MAAM,CAAC,CAAC;gBAChB,IAAA,oBAAO,EAAC,MAAM,CAAC,CAAC;gBAChB,IAAA,oBAAO,EAAC,MAAM,CAAC,CAAC;gBAChB,IAAA,sCAAyB,EAAC,MAAM,CAAC,CAAC;gBAElC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE;oBACjB,IAAA,iCAAmB,GAAE,CAAC;gBACxB,CAAC,CAAC,CAAC;;;;KACJ,EAAC"}
@@ -0,0 +1,4 @@
1
+ import Vorpal from "vorpal";
2
+ export declare const getAllNamespacesNames: () => Promise<string[]>;
3
+ declare const _default: (vorpal: Vorpal) => Promise<void>;
4
+ export default _default;
@@ -0,0 +1,274 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ exports.__esModule = true;
42
+ exports.getAllNamespacesNames = void 0;
43
+ var memoizee_1 = __importDefault(require("memoizee"));
44
+ var k8sApi_1 = __importDefault(require("../../../../k8sApi"));
45
+ var cluster_1 = require("../../../../utils/cluster");
46
+ var log_1 = require("../../../../utils/log");
47
+ var passwordstore_1 = require("../../../../utils/passwordstore");
48
+ var portForward_1 = require("../../../../utils/portForward");
49
+ var shell_1 = require("../../../../utils/shell");
50
+ var getGoogleAuthUserNumber_1 = require("../../utils/getGoogleAuthUserNumber");
51
+ var shared_1 = require("../shared");
52
+ var namespaceAutoCompletion_1 = require("./namespaceAutoCompletion");
53
+ var portForward_2 = __importDefault(require("./portForward"));
54
+ var getAllNamespaces = (0, memoizee_1["default"])(function () { return __awaiter(void 0, void 0, void 0, function () {
55
+ var res;
56
+ return __generator(this, function (_a) {
57
+ switch (_a.label) {
58
+ case 0: return [4 /*yield*/, k8sApi_1["default"].listNamespace()];
59
+ case 1:
60
+ res = _a.sent();
61
+ return [2 /*return*/, res.body.items];
62
+ }
63
+ });
64
+ }); }, { maxAge: 30000, promise: true });
65
+ var getAllNamespacesNames = function () { return __awaiter(void 0, void 0, void 0, function () {
66
+ var namespaces;
67
+ return __generator(this, function (_a) {
68
+ switch (_a.label) {
69
+ case 0: return [4 /*yield*/, getAllNamespaces()];
70
+ case 1:
71
+ namespaces = _a.sent();
72
+ return [2 /*return*/, namespaces.map(function (n) { return n.metadata.name; })];
73
+ }
74
+ });
75
+ }); };
76
+ exports.getAllNamespacesNames = getAllNamespacesNames;
77
+ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
78
+ return __generator(this, function (_a) {
79
+ vorpal
80
+ .command("connect-cluster <clustername>")
81
+ .autocomplete((0, cluster_1.getAllClusterNames)())
82
+ .action(function (_a) {
83
+ var clustername = _a.clustername;
84
+ return __awaiter(this, void 0, void 0, function () {
85
+ return __generator(this, function (_b) {
86
+ switch (_b.label) {
87
+ case 0:
88
+ this.log("connecting to ".concat(clustername));
89
+ return [4 /*yield*/, (0, cluster_1.connectToCluster)(clustername)];
90
+ case 1:
91
+ _b.sent();
92
+ return [2 /*return*/];
93
+ }
94
+ });
95
+ });
96
+ });
97
+ vorpal.command("current-context").action(function () {
98
+ return __awaiter(this, void 0, void 0, function () {
99
+ var _a;
100
+ return __generator(this, function (_b) {
101
+ switch (_b.label) {
102
+ case 0:
103
+ _a = this.log;
104
+ return [4 /*yield*/, (0, cluster_1.getCurrentContext)()];
105
+ case 1:
106
+ _a.apply(this, [_b.sent()]);
107
+ return [2 /*return*/];
108
+ }
109
+ });
110
+ });
111
+ });
112
+ vorpal
113
+ .command("list-namespaces", "list all namespaces")
114
+ .action(function () {
115
+ return __awaiter(this, void 0, void 0, function () {
116
+ var namespaces;
117
+ return __generator(this, function (_a) {
118
+ switch (_a.label) {
119
+ case 0: return [4 /*yield*/, (0, exports.getAllNamespacesNames)()];
120
+ case 1:
121
+ namespaces = _a.sent();
122
+ this.log(namespaces.join("\n"));
123
+ return [2 /*return*/];
124
+ }
125
+ });
126
+ });
127
+ });
128
+ vorpal
129
+ .command("list-secrets <namespace>", "show secrets")
130
+ .autocomplete(namespaceAutoCompletion_1.namespaceAutoCompletion)
131
+ .action(function (_a) {
132
+ var namespace = _a.namespace;
133
+ return __awaiter(this, void 0, void 0, function () {
134
+ var res;
135
+ return __generator(this, function (_b) {
136
+ switch (_b.label) {
137
+ case 0: return [4 /*yield*/, k8sApi_1["default"].listNamespacedSecret(namespace)];
138
+ case 1:
139
+ res = _b.sent();
140
+ this.log(res.body.items.map(function (n) { return n.metadata.name; }).join("\n"));
141
+ return [2 /*return*/];
142
+ }
143
+ });
144
+ });
145
+ });
146
+ vorpal.command("bw-sync", "force sync bitwarden").action(function () {
147
+ return __awaiter(this, void 0, void 0, function () {
148
+ return __generator(this, function (_a) {
149
+ switch (_a.label) {
150
+ case 0: return [4 /*yield*/, (0, passwordstore_1.syncBitwarden)(true)];
151
+ case 1:
152
+ _a.sent();
153
+ this.log("done");
154
+ return [2 /*return*/];
155
+ }
156
+ });
157
+ });
158
+ });
159
+ vorpal
160
+ .command("list-pods <namespace>", "list all pods of namespace")
161
+ .autocomplete(namespaceAutoCompletion_1.namespaceAutoCompletion)
162
+ .action(function (_a) {
163
+ var namespace = _a.namespace;
164
+ return __awaiter(this, void 0, void 0, function () {
165
+ var res;
166
+ return __generator(this, function (_b) {
167
+ switch (_b.label) {
168
+ case 0: return [4 /*yield*/, k8sApi_1["default"].listNamespacedPod(namespace)];
169
+ case 1:
170
+ res = _b.sent();
171
+ this.log(res.body.items.map(function (n) { return n.metadata.name; }).join("\n"));
172
+ return [2 /*return*/];
173
+ }
174
+ });
175
+ });
176
+ });
177
+ vorpal
178
+ .command("stop-portforward <name>", "stop a running port forward")
179
+ .autocomplete({ data: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
180
+ return [2 /*return*/, (0, portForward_1.getAllRunningPortForwards)()];
181
+ }); }); } })
182
+ .action(function (_a) {
183
+ var name = _a.name;
184
+ return __awaiter(this, void 0, void 0, function () {
185
+ return __generator(this, function (_b) {
186
+ (0, portForward_1.stopPortForward)(name.trim());
187
+ return [2 /*return*/];
188
+ });
189
+ });
190
+ });
191
+ vorpal
192
+ .command("open-dashboard <namespace>", "open kubernetes dashboard")
193
+ .autocomplete(namespaceAutoCompletion_1.namespaceAutoCompletion)
194
+ .action(function (_a) {
195
+ var namespace = _a.namespace;
196
+ return __awaiter(this, void 0, void 0, function () {
197
+ var clustername, authGoogleNumber;
198
+ return __generator(this, function (_b) {
199
+ switch (_b.label) {
200
+ case 0: return [4 /*yield*/, (0, cluster_1.getCurrentConnectedClusterName)()];
201
+ case 1:
202
+ clustername = _b.sent();
203
+ return [4 /*yield*/, getGoogleAuthUserNumber_1.getGoogleAuthUserNumber.call(this, vorpal)];
204
+ case 2:
205
+ authGoogleNumber = _b.sent();
206
+ return [4 /*yield*/, (0, shared_1.openGoogleCloudKubernetesDashboard)(authGoogleNumber, clustername, namespace)];
207
+ case 3:
208
+ _b.sent();
209
+ return [2 /*return*/];
210
+ }
211
+ });
212
+ });
213
+ });
214
+ vorpal
215
+ .command("open-logs <namespace>", "open google cloud logs (stackdriver stuff)")
216
+ .autocomplete(namespaceAutoCompletion_1.namespaceAutoCompletion)
217
+ .action(function (_a) {
218
+ var namespace = _a.namespace;
219
+ return __awaiter(this, void 0, void 0, function () {
220
+ var clustername, authGoogleNumber;
221
+ return __generator(this, function (_b) {
222
+ switch (_b.label) {
223
+ case 0: return [4 /*yield*/, (0, cluster_1.getCurrentConnectedClusterName)()];
224
+ case 1:
225
+ clustername = _b.sent();
226
+ return [4 /*yield*/, getGoogleAuthUserNumber_1.getGoogleAuthUserNumber.call(this, vorpal)];
227
+ case 2:
228
+ authGoogleNumber = _b.sent();
229
+ return [4 /*yield*/, (0, shared_1.openGoogleCloudLogs)(authGoogleNumber, clustername, namespace)];
230
+ case 3:
231
+ _b.sent();
232
+ return [2 /*return*/];
233
+ }
234
+ });
235
+ });
236
+ });
237
+ vorpal
238
+ .command("get-shell <namespace>", "get a shell to a pod in the environment")
239
+ .autocomplete(namespaceAutoCompletion_1.namespaceAutoCompletion)
240
+ .action(function (_a) {
241
+ var namespace = _a.namespace;
242
+ return __awaiter(this, void 0, void 0, function () {
243
+ var res, podNames, podName;
244
+ return __generator(this, function (_b) {
245
+ switch (_b.label) {
246
+ case 0: return [4 /*yield*/, k8sApi_1["default"].listNamespacedPod(namespace)];
247
+ case 1:
248
+ res = _b.sent();
249
+ if (res.body.items.length === 0) {
250
+ (0, log_1.logError)(this, "sorry, no pods found");
251
+ return [2 /*return*/];
252
+ }
253
+ podNames = res.body.items.map(function (i) { return i.metadata.name; });
254
+ return [4 /*yield*/, this.prompt({
255
+ type: "list",
256
+ name: "podName",
257
+ choices: podNames,
258
+ message: "Which pod? 🤔"
259
+ })];
260
+ case 2:
261
+ podName = (_b.sent()).podName;
262
+ return [4 /*yield*/, (0, shell_1.getShell)(namespace, podName)];
263
+ case 3:
264
+ _b.sent();
265
+ return [2 /*return*/];
266
+ }
267
+ });
268
+ });
269
+ });
270
+ (0, portForward_2["default"])(vorpal);
271
+ return [2 /*return*/];
272
+ });
273
+ }); });
274
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/general/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAgC;AAEhC,8DAAwC;AACxC,qDAKmC;AACnC,6CAAiD;AACjD,iEAAgE;AAChE,6DAGuC;AACvC,iDAAmD;AACnD,+EAA8E;AAC9E,oCAGmB;AACnB,qEAAoE;AACpE,8DAAwC;AAExC,IAAM,gBAAgB,GAAG,IAAA,qBAAQ,EAC/B;;;;oBACc,qBAAM,mBAAM,CAAC,aAAa,EAAE,EAAA;;gBAAlC,GAAG,GAAG,SAA4B;gBACxC,sBAAO,GAAG,CAAC,IAAI,CAAC,KAAK,EAAC;;;KACvB,EACD,EAAE,MA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C,MAAM,KAAK,CAAC,EAAE;gCAC/B,IAAA,cAAQ,EAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;gCACvC,sBAAO;6BACR;4BACK,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAf,CAAe,CAAC,CAAC;4BACxC,qBAAM,IAAI,CAAC,MAAM,CAAC;oCACpC,IAAI,EAAE,MAAM;oCACZ,IAAI,EAAE,SAAS;oCACf,OAAO,EAAE,QAAQ;oCACjB,OAAO,EAAE,eAAe;iCACzB,CAAC,EAAA;;4BALM,OAAO,GAAK,CAAA,SAKlB,CAAA,QALa;4BAOf,qBAAM,IAAA,gBAAQ,EAAC,SAAS,EAAE,OAAO,CAAC,EAAA;;4BAAlC,SAAkC,CAAC;;;;;SACpC,CAAC,CAAC;QAEL,IAAA,wBAAW,EAAC,MAAM,CAAC,CAAC;;;KACrB,EAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const namespaceAutoCompletion: {
2
+ data(): Promise<string[]>;
3
+ };
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ exports.__esModule = true;
39
+ exports.namespaceAutoCompletion = void 0;
40
+ var index_1 = require("./index");
41
+ exports.namespaceAutoCompletion = {
42
+ data: function () {
43
+ return __awaiter(this, void 0, void 0, function () {
44
+ var namespaces;
45
+ return __generator(this, function (_a) {
46
+ switch (_a.label) {
47
+ case 0: return [4 /*yield*/, (0, index_1.getAllNamespacesNames)()];
48
+ case 1:
49
+ namespaces = _a.sent();
50
+ return [2 /*return*/, namespaces];
51
+ }
52
+ });
53
+ });
54
+ }
55
+ };
56
+ //# sourceMappingURL=namespaceAutoCompletion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespaceAutoCompletion.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/general/namespaceAutoCompletion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAgD;AACnC,QAAA,uBAAuB,GAAG;IAC/B,IAAI;;;;;4BACW,qBAAM,IAAA,6BAAqB,GAAE,EAAA;;wBAA1C,UAAU,GAAG,SAA6B;wBAChD,sBAAO,UAAU,EAAC;;;;KACnB;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import Vorpal from "vorpal";
2
+ declare const _default: (vorpal: Vorpal) => Promise<Vorpal.Command>;
3
+ export default _default;