@marktrue/dsh-mobile-remote 3.2.3-rc.1 → 3.2.4-alpha.1-app

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 (353) hide show
  1. package/DSH-Remote-v3.2.4.apk +4 -0
  2. package/README.md +6 -254
  3. package/manifest.json +21 -0
  4. package/package.json +12 -65
  5. package/CHANGELOG.md +0 -1362
  6. package/CONTRIBUTING.md +0 -59
  7. package/FAQ.md +0 -111
  8. package/cordis.patch.yml +0 -14
  9. package/docs/00-/345/274/200/345/217/221/346/200/273/347/272/262.md +0 -125
  10. package/docs/01-PRD.md +0 -148
  11. package/docs/02-architecture.md +0 -249
  12. package/docs/03-api.md +0 -930
  13. package/docs/04-security.md +0 -100
  14. package/docs/05-test-cases.md +0 -405
  15. package/docs/06-install-run.md +0 -372
  16. package/docs/07-user-manual.md +0 -70
  17. package/docs/08-/346/211/251/345/261/225/345/274/200/345/217/221/346/214/207/345/215/227.md +0 -86
  18. package/docs/09-compatibility.md +0 -227
  19. package/docs/10-release.md +0 -929
  20. package/docs/screenshots/01-home.png +0 -0
  21. package/docs/screenshots/02-notifications.png +0 -0
  22. package/docs/screenshots/03-sessions.png +0 -0
  23. package/docs/screenshots/04-chat.png +0 -0
  24. package/docs/screenshots/05-settings.png +0 -0
  25. package/docs/screenshots/06-new-session.png +0 -0
  26. package/docs/screenshots/pgy-appstore.jpg +0 -0
  27. package/docs/screenshots/pgy-mobile-app.jpg +0 -0
  28. package/docs/screenshots/pgy-pc-client.jpg +0 -0
  29. package/docs/spec-app-auto-update.md +0 -143
  30. package/lib/account-usage.js +0 -145
  31. package/lib/app-alignment.js +0 -112
  32. package/lib/app-carrier-store.js +0 -1972
  33. package/lib/app-carrier.js +0 -609
  34. package/lib/client.js +0 -1174
  35. package/lib/desktop-form.js +0 -738
  36. package/lib/endpoint-registry.js +0 -165
  37. package/lib/git-read-bundled-provider.js +0 -255
  38. package/lib/git-read-service.js +0 -322
  39. package/lib/index.js +0 -9609
  40. package/lib/npm-update-source.js +0 -226
  41. package/lib/plugin-content-digest.js +0 -80
  42. package/lib/plugin-self-update.js +0 -997
  43. package/lib/plugin-update-controller.js +0 -274
  44. package/lib/plugin-update-log.js +0 -164
  45. package/lib/plugin-update-transaction.js +0 -322
  46. package/lib/plugin-update.js +0 -309
  47. package/lib/runtime-dependency-snapshot.js +0 -345
  48. package/lib/session-title-cache.js +0 -123
  49. package/lib/session-title-refresh.js +0 -261
  50. package/lib/tool-process.js +0 -20
  51. package/lib/update-fetch.js +0 -24
  52. package/lib/update-lock-arbiter.js +0 -170
  53. package/lib/update-supervisor.js +0 -346
  54. package/node_modules/ansi-regex/index.d.ts +0 -37
  55. package/node_modules/ansi-regex/index.js +0 -10
  56. package/node_modules/ansi-regex/license +0 -9
  57. package/node_modules/ansi-regex/package.json +0 -55
  58. package/node_modules/ansi-regex/readme.md +0 -78
  59. package/node_modules/ansi-styles/index.d.ts +0 -345
  60. package/node_modules/ansi-styles/index.js +0 -163
  61. package/node_modules/ansi-styles/license +0 -9
  62. package/node_modules/ansi-styles/package.json +0 -56
  63. package/node_modules/ansi-styles/readme.md +0 -152
  64. package/node_modules/camelcase/index.d.ts +0 -63
  65. package/node_modules/camelcase/index.js +0 -76
  66. package/node_modules/camelcase/license +0 -9
  67. package/node_modules/camelcase/package.json +0 -43
  68. package/node_modules/camelcase/readme.md +0 -99
  69. package/node_modules/cliui/CHANGELOG.md +0 -76
  70. package/node_modules/cliui/LICENSE.txt +0 -14
  71. package/node_modules/cliui/README.md +0 -115
  72. package/node_modules/cliui/index.js +0 -354
  73. package/node_modules/cliui/package.json +0 -65
  74. package/node_modules/color-convert/CHANGELOG.md +0 -54
  75. package/node_modules/color-convert/LICENSE +0 -21
  76. package/node_modules/color-convert/README.md +0 -68
  77. package/node_modules/color-convert/conversions.js +0 -839
  78. package/node_modules/color-convert/index.js +0 -81
  79. package/node_modules/color-convert/package.json +0 -48
  80. package/node_modules/color-convert/route.js +0 -97
  81. package/node_modules/color-name/LICENSE +0 -8
  82. package/node_modules/color-name/README.md +0 -11
  83. package/node_modules/color-name/index.js +0 -152
  84. package/node_modules/color-name/package.json +0 -28
  85. package/node_modules/decamelize/index.js +0 -13
  86. package/node_modules/decamelize/license +0 -21
  87. package/node_modules/decamelize/package.json +0 -38
  88. package/node_modules/decamelize/readme.md +0 -48
  89. package/node_modules/dijkstrajs/.travis.yml +0 -4
  90. package/node_modules/dijkstrajs/CONTRIBUTING.md +0 -8
  91. package/node_modules/dijkstrajs/LICENSE.md +0 -19
  92. package/node_modules/dijkstrajs/README.md +0 -18
  93. package/node_modules/dijkstrajs/dijkstra.js +0 -165
  94. package/node_modules/dijkstrajs/package.json +0 -60
  95. package/node_modules/dijkstrajs/test/dijkstra.test.js +0 -96
  96. package/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
  97. package/node_modules/emoji-regex/README.md +0 -73
  98. package/node_modules/emoji-regex/es2015/index.js +0 -6
  99. package/node_modules/emoji-regex/es2015/text.js +0 -6
  100. package/node_modules/emoji-regex/index.d.ts +0 -23
  101. package/node_modules/emoji-regex/index.js +0 -6
  102. package/node_modules/emoji-regex/package.json +0 -50
  103. package/node_modules/emoji-regex/text.js +0 -6
  104. package/node_modules/find-up/index.d.ts +0 -137
  105. package/node_modules/find-up/index.js +0 -89
  106. package/node_modules/find-up/license +0 -9
  107. package/node_modules/find-up/package.json +0 -53
  108. package/node_modules/find-up/readme.md +0 -156
  109. package/node_modules/get-caller-file/LICENSE.md +0 -6
  110. package/node_modules/get-caller-file/README.md +0 -41
  111. package/node_modules/get-caller-file/index.d.ts +0 -2
  112. package/node_modules/get-caller-file/index.js +0 -22
  113. package/node_modules/get-caller-file/index.js.map +0 -1
  114. package/node_modules/get-caller-file/package.json +0 -42
  115. package/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
  116. package/node_modules/is-fullwidth-code-point/index.js +0 -50
  117. package/node_modules/is-fullwidth-code-point/license +0 -9
  118. package/node_modules/is-fullwidth-code-point/package.json +0 -42
  119. package/node_modules/is-fullwidth-code-point/readme.md +0 -39
  120. package/node_modules/locate-path/index.d.ts +0 -83
  121. package/node_modules/locate-path/index.js +0 -65
  122. package/node_modules/locate-path/license +0 -9
  123. package/node_modules/locate-path/package.json +0 -45
  124. package/node_modules/locate-path/readme.md +0 -122
  125. package/node_modules/p-limit/index.d.ts +0 -38
  126. package/node_modules/p-limit/index.js +0 -57
  127. package/node_modules/p-limit/license +0 -9
  128. package/node_modules/p-limit/package.json +0 -52
  129. package/node_modules/p-limit/readme.md +0 -101
  130. package/node_modules/p-locate/index.d.ts +0 -64
  131. package/node_modules/p-locate/index.js +0 -52
  132. package/node_modules/p-locate/license +0 -9
  133. package/node_modules/p-locate/package.json +0 -53
  134. package/node_modules/p-locate/readme.md +0 -90
  135. package/node_modules/p-try/index.d.ts +0 -39
  136. package/node_modules/p-try/index.js +0 -9
  137. package/node_modules/p-try/license +0 -9
  138. package/node_modules/p-try/package.json +0 -42
  139. package/node_modules/p-try/readme.md +0 -58
  140. package/node_modules/path-exists/index.d.ts +0 -28
  141. package/node_modules/path-exists/index.js +0 -23
  142. package/node_modules/path-exists/license +0 -9
  143. package/node_modules/path-exists/package.json +0 -39
  144. package/node_modules/path-exists/readme.md +0 -52
  145. package/node_modules/pngjs/.eslintignore +0 -2
  146. package/node_modules/pngjs/.eslintrc.json +0 -19
  147. package/node_modules/pngjs/.prettierignore +0 -3
  148. package/node_modules/pngjs/LICENSE +0 -20
  149. package/node_modules/pngjs/README.md +0 -429
  150. package/node_modules/pngjs/browser.js +0 -16096
  151. package/node_modules/pngjs/coverage/lcov-report/base.css +0 -354
  152. package/node_modules/pngjs/coverage/lcov-report/bitmapper.js.html +0 -881
  153. package/node_modules/pngjs/coverage/lcov-report/bitpacker.js.html +0 -554
  154. package/node_modules/pngjs/coverage/lcov-report/block-navigation.js +0 -77
  155. package/node_modules/pngjs/coverage/lcov-report/chunkstream.js.html +0 -647
  156. package/node_modules/pngjs/coverage/lcov-report/constants.js.html +0 -176
  157. package/node_modules/pngjs/coverage/lcov-report/crc.js.html +0 -200
  158. package/node_modules/pngjs/coverage/lcov-report/favicon.png +0 -0
  159. package/node_modules/pngjs/coverage/lcov-report/filter-pack.js.html +0 -593
  160. package/node_modules/pngjs/coverage/lcov-report/filter-parse-async.js.html +0 -152
  161. package/node_modules/pngjs/coverage/lcov-report/filter-parse-sync.js.html +0 -143
  162. package/node_modules/pngjs/coverage/lcov-report/filter-parse.js.html +0 -611
  163. package/node_modules/pngjs/coverage/lcov-report/format-normaliser.js.html +0 -359
  164. package/node_modules/pngjs/coverage/lcov-report/index.html +0 -426
  165. package/node_modules/pngjs/coverage/lcov-report/interlace.js.html +0 -365
  166. package/node_modules/pngjs/coverage/lcov-report/packer-async.js.html +0 -230
  167. package/node_modules/pngjs/coverage/lcov-report/packer-sync.js.html +0 -248
  168. package/node_modules/pngjs/coverage/lcov-report/packer.js.html +0 -467
  169. package/node_modules/pngjs/coverage/lcov-report/paeth-predictor.js.html +0 -128
  170. package/node_modules/pngjs/coverage/lcov-report/parser-async.js.html +0 -575
  171. package/node_modules/pngjs/coverage/lcov-report/parser-sync.js.html +0 -404
  172. package/node_modules/pngjs/coverage/lcov-report/parser.js.html +0 -950
  173. package/node_modules/pngjs/coverage/lcov-report/png-sync.js.html +0 -116
  174. package/node_modules/pngjs/coverage/lcov-report/png.js.html +0 -662
  175. package/node_modules/pngjs/coverage/lcov-report/prettify.css +0 -101
  176. package/node_modules/pngjs/coverage/lcov-report/prettify.js +0 -1007
  177. package/node_modules/pngjs/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  178. package/node_modules/pngjs/coverage/lcov-report/sorter.js +0 -169
  179. package/node_modules/pngjs/coverage/lcov-report/sync-inflate.js.html +0 -584
  180. package/node_modules/pngjs/coverage/lcov-report/sync-reader.js.html +0 -215
  181. package/node_modules/pngjs/coverage/lcov.info +0 -2177
  182. package/node_modules/pngjs/lib/bitmapper.js +0 -267
  183. package/node_modules/pngjs/lib/bitpacker.js +0 -158
  184. package/node_modules/pngjs/lib/chunkstream.js +0 -189
  185. package/node_modules/pngjs/lib/constants.js +0 -32
  186. package/node_modules/pngjs/lib/crc.js +0 -40
  187. package/node_modules/pngjs/lib/filter-pack.js +0 -171
  188. package/node_modules/pngjs/lib/filter-parse-async.js +0 -24
  189. package/node_modules/pngjs/lib/filter-parse-sync.js +0 -21
  190. package/node_modules/pngjs/lib/filter-parse.js +0 -177
  191. package/node_modules/pngjs/lib/format-normaliser.js +0 -93
  192. package/node_modules/pngjs/lib/interlace.js +0 -95
  193. package/node_modules/pngjs/lib/packer-async.js +0 -50
  194. package/node_modules/pngjs/lib/packer-sync.js +0 -56
  195. package/node_modules/pngjs/lib/packer.js +0 -129
  196. package/node_modules/pngjs/lib/paeth-predictor.js +0 -16
  197. package/node_modules/pngjs/lib/parser-async.js +0 -165
  198. package/node_modules/pngjs/lib/parser-sync.js +0 -108
  199. package/node_modules/pngjs/lib/parser.js +0 -290
  200. package/node_modules/pngjs/lib/png-sync.js +0 -12
  201. package/node_modules/pngjs/lib/png.js +0 -194
  202. package/node_modules/pngjs/lib/sync-inflate.js +0 -168
  203. package/node_modules/pngjs/lib/sync-reader.js +0 -45
  204. package/node_modules/pngjs/package.json +0 -73
  205. package/node_modules/qrcode/README.md +0 -770
  206. package/node_modules/qrcode/bin/qrcode +0 -159
  207. package/node_modules/qrcode/helper/to-sjis-browser.js +0 -2
  208. package/node_modules/qrcode/helper/to-sjis.js +0 -105
  209. package/node_modules/qrcode/lib/browser.js +0 -76
  210. package/node_modules/qrcode/lib/can-promise.js +0 -7
  211. package/node_modules/qrcode/lib/core/alignment-pattern.js +0 -83
  212. package/node_modules/qrcode/lib/core/alphanumeric-data.js +0 -59
  213. package/node_modules/qrcode/lib/core/bit-buffer.js +0 -37
  214. package/node_modules/qrcode/lib/core/bit-matrix.js +0 -65
  215. package/node_modules/qrcode/lib/core/byte-data.js +0 -30
  216. package/node_modules/qrcode/lib/core/error-correction-code.js +0 -135
  217. package/node_modules/qrcode/lib/core/error-correction-level.js +0 -50
  218. package/node_modules/qrcode/lib/core/finder-pattern.js +0 -22
  219. package/node_modules/qrcode/lib/core/format-info.js +0 -29
  220. package/node_modules/qrcode/lib/core/galois-field.js +0 -69
  221. package/node_modules/qrcode/lib/core/kanji-data.js +0 -54
  222. package/node_modules/qrcode/lib/core/mask-pattern.js +0 -234
  223. package/node_modules/qrcode/lib/core/mode.js +0 -167
  224. package/node_modules/qrcode/lib/core/numeric-data.js +0 -43
  225. package/node_modules/qrcode/lib/core/polynomial.js +0 -62
  226. package/node_modules/qrcode/lib/core/qrcode.js +0 -495
  227. package/node_modules/qrcode/lib/core/reed-solomon-encoder.js +0 -56
  228. package/node_modules/qrcode/lib/core/regex.js +0 -31
  229. package/node_modules/qrcode/lib/core/segments.js +0 -330
  230. package/node_modules/qrcode/lib/core/utils.js +0 -63
  231. package/node_modules/qrcode/lib/core/version-check.js +0 -9
  232. package/node_modules/qrcode/lib/core/version.js +0 -163
  233. package/node_modules/qrcode/lib/index.js +0 -12
  234. package/node_modules/qrcode/lib/renderer/canvas.js +0 -63
  235. package/node_modules/qrcode/lib/renderer/png.js +0 -78
  236. package/node_modules/qrcode/lib/renderer/svg-tag.js +0 -81
  237. package/node_modules/qrcode/lib/renderer/svg.js +0 -19
  238. package/node_modules/qrcode/lib/renderer/terminal/terminal-small.js +0 -85
  239. package/node_modules/qrcode/lib/renderer/terminal/terminal.js +0 -49
  240. package/node_modules/qrcode/lib/renderer/terminal.js +0 -9
  241. package/node_modules/qrcode/lib/renderer/utf8.js +0 -71
  242. package/node_modules/qrcode/lib/renderer/utils.js +0 -99
  243. package/node_modules/qrcode/lib/server.js +0 -138
  244. package/node_modules/qrcode/license +0 -10
  245. package/node_modules/qrcode/package.json +0 -77
  246. package/node_modules/require-directory/.jshintrc +0 -67
  247. package/node_modules/require-directory/.npmignore +0 -1
  248. package/node_modules/require-directory/.travis.yml +0 -3
  249. package/node_modules/require-directory/LICENSE +0 -22
  250. package/node_modules/require-directory/README.markdown +0 -184
  251. package/node_modules/require-directory/index.js +0 -86
  252. package/node_modules/require-directory/package.json +0 -40
  253. package/node_modules/require-main-filename/CHANGELOG.md +0 -26
  254. package/node_modules/require-main-filename/LICENSE.txt +0 -14
  255. package/node_modules/require-main-filename/README.md +0 -26
  256. package/node_modules/require-main-filename/index.js +0 -18
  257. package/node_modules/require-main-filename/package.json +0 -35
  258. package/node_modules/set-blocking/CHANGELOG.md +0 -26
  259. package/node_modules/set-blocking/LICENSE.txt +0 -14
  260. package/node_modules/set-blocking/README.md +0 -31
  261. package/node_modules/set-blocking/index.js +0 -7
  262. package/node_modules/set-blocking/package.json +0 -42
  263. package/node_modules/string-width/index.d.ts +0 -29
  264. package/node_modules/string-width/index.js +0 -47
  265. package/node_modules/string-width/license +0 -9
  266. package/node_modules/string-width/package.json +0 -56
  267. package/node_modules/string-width/readme.md +0 -50
  268. package/node_modules/strip-ansi/index.d.ts +0 -17
  269. package/node_modules/strip-ansi/index.js +0 -4
  270. package/node_modules/strip-ansi/license +0 -9
  271. package/node_modules/strip-ansi/package.json +0 -54
  272. package/node_modules/strip-ansi/readme.md +0 -46
  273. package/node_modules/which-module/LICENSE +0 -13
  274. package/node_modules/which-module/README.md +0 -58
  275. package/node_modules/which-module/index.js +0 -9
  276. package/node_modules/which-module/package.json +0 -41
  277. package/node_modules/wrap-ansi/index.js +0 -186
  278. package/node_modules/wrap-ansi/license +0 -9
  279. package/node_modules/wrap-ansi/package.json +0 -61
  280. package/node_modules/wrap-ansi/readme.md +0 -97
  281. package/node_modules/y18n/CHANGELOG.md +0 -35
  282. package/node_modules/y18n/LICENSE +0 -13
  283. package/node_modules/y18n/README.md +0 -109
  284. package/node_modules/y18n/index.js +0 -188
  285. package/node_modules/y18n/package.json +0 -39
  286. package/node_modules/yargs/CHANGELOG.md +0 -420
  287. package/node_modules/yargs/LICENSE +0 -21
  288. package/node_modules/yargs/README.md +0 -140
  289. package/node_modules/yargs/build/lib/apply-extends.d.ts +0 -2
  290. package/node_modules/yargs/build/lib/apply-extends.js +0 -65
  291. package/node_modules/yargs/build/lib/argsert.d.ts +0 -2
  292. package/node_modules/yargs/build/lib/argsert.js +0 -65
  293. package/node_modules/yargs/build/lib/command.d.ts +0 -64
  294. package/node_modules/yargs/build/lib/command.js +0 -416
  295. package/node_modules/yargs/build/lib/common-types.d.ts +0 -36
  296. package/node_modules/yargs/build/lib/common-types.js +0 -25
  297. package/node_modules/yargs/build/lib/completion-templates.d.ts +0 -2
  298. package/node_modules/yargs/build/lib/completion-templates.js +0 -50
  299. package/node_modules/yargs/build/lib/completion.d.ts +0 -21
  300. package/node_modules/yargs/build/lib/completion.js +0 -135
  301. package/node_modules/yargs/build/lib/is-promise.d.ts +0 -1
  302. package/node_modules/yargs/build/lib/is-promise.js +0 -9
  303. package/node_modules/yargs/build/lib/levenshtein.d.ts +0 -1
  304. package/node_modules/yargs/build/lib/levenshtein.js +0 -58
  305. package/node_modules/yargs/build/lib/middleware.d.ts +0 -10
  306. package/node_modules/yargs/build/lib/middleware.js +0 -57
  307. package/node_modules/yargs/build/lib/obj-filter.d.ts +0 -1
  308. package/node_modules/yargs/build/lib/obj-filter.js +0 -14
  309. package/node_modules/yargs/build/lib/parse-command.d.ts +0 -11
  310. package/node_modules/yargs/build/lib/parse-command.js +0 -36
  311. package/node_modules/yargs/build/lib/process-argv.d.ts +0 -2
  312. package/node_modules/yargs/build/lib/process-argv.js +0 -31
  313. package/node_modules/yargs/build/lib/usage.d.ts +0 -49
  314. package/node_modules/yargs/build/lib/usage.js +0 -540
  315. package/node_modules/yargs/build/lib/validation.d.ts +0 -34
  316. package/node_modules/yargs/build/lib/validation.js +0 -330
  317. package/node_modules/yargs/build/lib/yargs.d.ts +0 -274
  318. package/node_modules/yargs/build/lib/yargs.js +0 -1190
  319. package/node_modules/yargs/build/lib/yerror.d.ts +0 -4
  320. package/node_modules/yargs/build/lib/yerror.js +0 -11
  321. package/node_modules/yargs/index.js +0 -40
  322. package/node_modules/yargs/locales/be.json +0 -46
  323. package/node_modules/yargs/locales/de.json +0 -46
  324. package/node_modules/yargs/locales/en.json +0 -51
  325. package/node_modules/yargs/locales/es.json +0 -46
  326. package/node_modules/yargs/locales/fi.json +0 -49
  327. package/node_modules/yargs/locales/fr.json +0 -53
  328. package/node_modules/yargs/locales/hi.json +0 -49
  329. package/node_modules/yargs/locales/hu.json +0 -46
  330. package/node_modules/yargs/locales/id.json +0 -50
  331. package/node_modules/yargs/locales/it.json +0 -46
  332. package/node_modules/yargs/locales/ja.json +0 -51
  333. package/node_modules/yargs/locales/ko.json +0 -49
  334. package/node_modules/yargs/locales/nb.json +0 -44
  335. package/node_modules/yargs/locales/nl.json +0 -49
  336. package/node_modules/yargs/locales/nn.json +0 -44
  337. package/node_modules/yargs/locales/pirate.json +0 -13
  338. package/node_modules/yargs/locales/pl.json +0 -49
  339. package/node_modules/yargs/locales/pt.json +0 -45
  340. package/node_modules/yargs/locales/pt_BR.json +0 -48
  341. package/node_modules/yargs/locales/ru.json +0 -46
  342. package/node_modules/yargs/locales/th.json +0 -46
  343. package/node_modules/yargs/locales/tr.json +0 -48
  344. package/node_modules/yargs/locales/zh_CN.json +0 -48
  345. package/node_modules/yargs/locales/zh_TW.json +0 -47
  346. package/node_modules/yargs/package.json +0 -92
  347. package/node_modules/yargs/yargs.js +0 -14
  348. package/node_modules/yargs-parser/CHANGELOG.md +0 -601
  349. package/node_modules/yargs-parser/LICENSE.txt +0 -14
  350. package/node_modules/yargs-parser/README.md +0 -449
  351. package/node_modules/yargs-parser/index.js +0 -1032
  352. package/node_modules/yargs-parser/lib/tokenize-arg-string.js +0 -40
  353. package/node_modules/yargs-parser/package.json +0 -46
@@ -1,540 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usage = void 0;
4
- // this file handles outputting usage instructions,
5
- // failures, etc. keeps logging in one place.
6
- const common_types_1 = require("./common-types");
7
- const obj_filter_1 = require("./obj-filter");
8
- const path = require("path");
9
- const yerror_1 = require("./yerror");
10
- const decamelize = require("decamelize");
11
- const setBlocking = require("set-blocking");
12
- const stringWidth = require("string-width");
13
- function usage(yargs, y18n) {
14
- const __ = y18n.__;
15
- const self = {};
16
- // methods for ouputting/building failure message.
17
- const fails = [];
18
- self.failFn = function failFn(f) {
19
- fails.push(f);
20
- };
21
- let failMessage = null;
22
- let showHelpOnFail = true;
23
- self.showHelpOnFail = function showHelpOnFailFn(arg1 = true, arg2) {
24
- function parseFunctionArgs() {
25
- return typeof arg1 === 'string' ? [true, arg1] : [arg1, arg2];
26
- }
27
- const [enabled, message] = parseFunctionArgs();
28
- failMessage = message;
29
- showHelpOnFail = enabled;
30
- return self;
31
- };
32
- let failureOutput = false;
33
- self.fail = function fail(msg, err) {
34
- const logger = yargs._getLoggerInstance();
35
- if (fails.length) {
36
- for (let i = fails.length - 1; i >= 0; --i) {
37
- fails[i](msg, err, self);
38
- }
39
- }
40
- else {
41
- if (yargs.getExitProcess())
42
- setBlocking(true);
43
- // don't output failure message more than once
44
- if (!failureOutput) {
45
- failureOutput = true;
46
- if (showHelpOnFail) {
47
- yargs.showHelp('error');
48
- logger.error();
49
- }
50
- if (msg || err)
51
- logger.error(msg || err);
52
- if (failMessage) {
53
- if (msg || err)
54
- logger.error('');
55
- logger.error(failMessage);
56
- }
57
- }
58
- err = err || new yerror_1.YError(msg);
59
- if (yargs.getExitProcess()) {
60
- return yargs.exit(1);
61
- }
62
- else if (yargs._hasParseCallback()) {
63
- return yargs.exit(1, err);
64
- }
65
- else {
66
- throw err;
67
- }
68
- }
69
- };
70
- // methods for ouputting/building help (usage) message.
71
- let usages = [];
72
- let usageDisabled = false;
73
- self.usage = (msg, description) => {
74
- if (msg === null) {
75
- usageDisabled = true;
76
- usages = [];
77
- return self;
78
- }
79
- usageDisabled = false;
80
- usages.push([msg, description || '']);
81
- return self;
82
- };
83
- self.getUsage = () => {
84
- return usages;
85
- };
86
- self.getUsageDisabled = () => {
87
- return usageDisabled;
88
- };
89
- self.getPositionalGroupName = () => {
90
- return __('Positionals:');
91
- };
92
- let examples = [];
93
- self.example = (cmd, description) => {
94
- examples.push([cmd, description || '']);
95
- };
96
- let commands = [];
97
- self.command = function command(cmd, description, isDefault, aliases, deprecated = false) {
98
- // the last default wins, so cancel out any previously set default
99
- if (isDefault) {
100
- commands = commands.map((cmdArray) => {
101
- cmdArray[2] = false;
102
- return cmdArray;
103
- });
104
- }
105
- commands.push([cmd, description || '', isDefault, aliases, deprecated]);
106
- };
107
- self.getCommands = () => commands;
108
- let descriptions = {};
109
- self.describe = function describe(keyOrKeys, desc) {
110
- if (Array.isArray(keyOrKeys)) {
111
- keyOrKeys.forEach((k) => {
112
- self.describe(k, desc);
113
- });
114
- }
115
- else if (typeof keyOrKeys === 'object') {
116
- Object.keys(keyOrKeys).forEach((k) => {
117
- self.describe(k, keyOrKeys[k]);
118
- });
119
- }
120
- else {
121
- descriptions[keyOrKeys] = desc;
122
- }
123
- };
124
- self.getDescriptions = () => descriptions;
125
- let epilogs = [];
126
- self.epilog = (msg) => {
127
- epilogs.push(msg);
128
- };
129
- let wrapSet = false;
130
- let wrap;
131
- self.wrap = (cols) => {
132
- wrapSet = true;
133
- wrap = cols;
134
- };
135
- function getWrap() {
136
- if (!wrapSet) {
137
- wrap = windowWidth();
138
- wrapSet = true;
139
- }
140
- return wrap;
141
- }
142
- const deferY18nLookupPrefix = '__yargsString__:';
143
- self.deferY18nLookup = str => deferY18nLookupPrefix + str;
144
- self.help = function help() {
145
- if (cachedHelpMessage)
146
- return cachedHelpMessage;
147
- normalizeAliases();
148
- // handle old demanded API
149
- const base$0 = yargs.customScriptName ? yargs.$0 : path.basename(yargs.$0);
150
- const demandedOptions = yargs.getDemandedOptions();
151
- const demandedCommands = yargs.getDemandedCommands();
152
- const deprecatedOptions = yargs.getDeprecatedOptions();
153
- const groups = yargs.getGroups();
154
- const options = yargs.getOptions();
155
- let keys = [];
156
- keys = keys.concat(Object.keys(descriptions));
157
- keys = keys.concat(Object.keys(demandedOptions));
158
- keys = keys.concat(Object.keys(demandedCommands));
159
- keys = keys.concat(Object.keys(options.default));
160
- keys = keys.filter(filterHiddenOptions);
161
- keys = Object.keys(keys.reduce((acc, key) => {
162
- if (key !== '_')
163
- acc[key] = true;
164
- return acc;
165
- }, {}));
166
- const theWrap = getWrap();
167
- const ui = require('cliui')({
168
- width: theWrap,
169
- wrap: !!theWrap
170
- });
171
- // the usage string.
172
- if (!usageDisabled) {
173
- if (usages.length) {
174
- // user-defined usage.
175
- usages.forEach((usage) => {
176
- ui.div(`${usage[0].replace(/\$0/g, base$0)}`);
177
- if (usage[1]) {
178
- ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] });
179
- }
180
- });
181
- ui.div();
182
- }
183
- else if (commands.length) {
184
- let u = null;
185
- // demonstrate how commands are used.
186
- if (demandedCommands._) {
187
- u = `${base$0} <${__('command')}>\n`;
188
- }
189
- else {
190
- u = `${base$0} [${__('command')}]\n`;
191
- }
192
- ui.div(`${u}`);
193
- }
194
- }
195
- // your application's commands, i.e., non-option
196
- // arguments populated in '_'.
197
- if (commands.length) {
198
- ui.div(__('Commands:'));
199
- const context = yargs.getContext();
200
- const parentCommands = context.commands.length ? `${context.commands.join(' ')} ` : '';
201
- if (yargs.getParserConfiguration()['sort-commands'] === true) {
202
- commands = commands.sort((a, b) => a[0].localeCompare(b[0]));
203
- }
204
- commands.forEach((command) => {
205
- const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}`; // drop $0 from default commands.
206
- ui.span({
207
- text: commandString,
208
- padding: [0, 2, 0, 2],
209
- width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4
210
- }, { text: command[1] });
211
- const hints = [];
212
- if (command[2])
213
- hints.push(`[${__('default')}]`);
214
- if (command[3] && command[3].length) {
215
- hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`);
216
- }
217
- if (command[4]) {
218
- if (typeof command[4] === 'string') {
219
- hints.push(`[${__('deprecated: %s', command[4])}]`);
220
- }
221
- else {
222
- hints.push(`[${__('deprecated')}]`);
223
- }
224
- }
225
- if (hints.length) {
226
- ui.div({ text: hints.join(' '), padding: [0, 0, 0, 2], align: 'right' });
227
- }
228
- else {
229
- ui.div();
230
- }
231
- });
232
- ui.div();
233
- }
234
- // perform some cleanup on the keys array, making it
235
- // only include top-level keys not their aliases.
236
- const aliasKeys = (Object.keys(options.alias) || [])
237
- .concat(Object.keys(yargs.parsed.newAliases) || []);
238
- keys = keys.filter(key => !yargs.parsed.newAliases[key] && aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1));
239
- // populate 'Options:' group with any keys that have not
240
- // explicitly had a group set.
241
- const defaultGroup = __('Options:');
242
- if (!groups[defaultGroup])
243
- groups[defaultGroup] = [];
244
- addUngroupedKeys(keys, options.alias, groups, defaultGroup);
245
- // display 'Options:' table along with any custom tables:
246
- Object.keys(groups).forEach((groupName) => {
247
- if (!groups[groupName].length)
248
- return;
249
- // if we've grouped the key 'f', but 'f' aliases 'foobar',
250
- // normalizedKeys should contain only 'foobar'.
251
- const normalizedKeys = groups[groupName].filter(filterHiddenOptions).map((key) => {
252
- if (~aliasKeys.indexOf(key))
253
- return key;
254
- for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
255
- if (~(options.alias[aliasKey] || []).indexOf(key))
256
- return aliasKey;
257
- }
258
- return key;
259
- });
260
- if (normalizedKeys.length < 1)
261
- return;
262
- ui.div(groupName);
263
- // actually generate the switches string --foo, -f, --bar.
264
- const switches = normalizedKeys.reduce((acc, key) => {
265
- acc[key] = [key].concat(options.alias[key] || [])
266
- .map(sw => {
267
- // for the special positional group don't
268
- // add '--' or '-' prefix.
269
- if (groupName === self.getPositionalGroupName())
270
- return sw;
271
- else {
272
- return (
273
- // matches yargs-parser logic in which single-digits
274
- // aliases declared with a boolean type are now valid
275
- /^[0-9]$/.test(sw)
276
- ? ~options.boolean.indexOf(key) ? '-' : '--'
277
- : sw.length > 1 ? '--' : '-') + sw;
278
- }
279
- })
280
- .join(', ');
281
- return acc;
282
- }, {});
283
- normalizedKeys.forEach((key) => {
284
- const kswitch = switches[key];
285
- let desc = descriptions[key] || '';
286
- let type = null;
287
- if (~desc.lastIndexOf(deferY18nLookupPrefix))
288
- desc = __(desc.substring(deferY18nLookupPrefix.length));
289
- if (~options.boolean.indexOf(key))
290
- type = `[${__('boolean')}]`;
291
- if (~options.count.indexOf(key))
292
- type = `[${__('count')}]`;
293
- if (~options.string.indexOf(key))
294
- type = `[${__('string')}]`;
295
- if (~options.normalize.indexOf(key))
296
- type = `[${__('string')}]`;
297
- if (~options.array.indexOf(key))
298
- type = `[${__('array')}]`;
299
- if (~options.number.indexOf(key))
300
- type = `[${__('number')}]`;
301
- const deprecatedExtra = (deprecated) => typeof deprecated === 'string'
302
- ? `[${__('deprecated: %s', deprecated)}]`
303
- : `[${__('deprecated')}]`;
304
- const extra = [
305
- (key in deprecatedOptions) ? deprecatedExtra(deprecatedOptions[key]) : null,
306
- type,
307
- (key in demandedOptions) ? `[${__('required')}]` : null,
308
- options.choices && options.choices[key] ? `[${__('choices:')} ${self.stringifiedValues(options.choices[key])}]` : null,
309
- defaultString(options.default[key], options.defaultDescription[key])
310
- ].filter(Boolean).join(' ');
311
- ui.span({ text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches, theWrap) + 4 }, desc);
312
- if (extra)
313
- ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' });
314
- else
315
- ui.div();
316
- });
317
- ui.div();
318
- });
319
- // describe some common use-cases for your application.
320
- if (examples.length) {
321
- ui.div(__('Examples:'));
322
- examples.forEach((example) => {
323
- example[0] = example[0].replace(/\$0/g, base$0);
324
- });
325
- examples.forEach((example) => {
326
- if (example[1] === '') {
327
- ui.div({
328
- text: example[0],
329
- padding: [0, 2, 0, 2]
330
- });
331
- }
332
- else {
333
- ui.div({
334
- text: example[0],
335
- padding: [0, 2, 0, 2],
336
- width: maxWidth(examples, theWrap) + 4
337
- }, {
338
- text: example[1]
339
- });
340
- }
341
- });
342
- ui.div();
343
- }
344
- // the usage string.
345
- if (epilogs.length > 0) {
346
- const e = epilogs.map(epilog => epilog.replace(/\$0/g, base$0)).join('\n');
347
- ui.div(`${e}\n`);
348
- }
349
- // Remove the trailing white spaces
350
- return ui.toString().replace(/\s*$/, '');
351
- };
352
- // return the maximum width of a string
353
- // in the left-hand column of a table.
354
- function maxWidth(table, theWrap, modifier) {
355
- let width = 0;
356
- // table might be of the form [leftColumn],
357
- // or {key: leftColumn}
358
- if (!Array.isArray(table)) {
359
- table = Object.values(table).map(v => [v]);
360
- }
361
- table.forEach((v) => {
362
- width = Math.max(stringWidth(modifier ? `${modifier} ${v[0]}` : v[0]), width);
363
- });
364
- // if we've enabled 'wrap' we should limit
365
- // the max-width of the left-column.
366
- if (theWrap)
367
- width = Math.min(width, parseInt((theWrap * 0.5).toString(), 10));
368
- return width;
369
- }
370
- // make sure any options set for aliases,
371
- // are copied to the keys being aliased.
372
- function normalizeAliases() {
373
- // handle old demanded API
374
- const demandedOptions = yargs.getDemandedOptions();
375
- const options = yargs.getOptions();
376
- (Object.keys(options.alias) || []).forEach((key) => {
377
- options.alias[key].forEach((alias) => {
378
- // copy descriptions.
379
- if (descriptions[alias])
380
- self.describe(key, descriptions[alias]);
381
- // copy demanded.
382
- if (alias in demandedOptions)
383
- yargs.demandOption(key, demandedOptions[alias]);
384
- // type messages.
385
- if (~options.boolean.indexOf(alias))
386
- yargs.boolean(key);
387
- if (~options.count.indexOf(alias))
388
- yargs.count(key);
389
- if (~options.string.indexOf(alias))
390
- yargs.string(key);
391
- if (~options.normalize.indexOf(alias))
392
- yargs.normalize(key);
393
- if (~options.array.indexOf(alias))
394
- yargs.array(key);
395
- if (~options.number.indexOf(alias))
396
- yargs.number(key);
397
- });
398
- });
399
- }
400
- // if yargs is executing an async handler, we take a snapshot of the
401
- // help message to display on failure:
402
- let cachedHelpMessage;
403
- self.cacheHelpMessage = function () {
404
- cachedHelpMessage = this.help();
405
- };
406
- // however this snapshot must be cleared afterwards
407
- // not to be be used by next calls to parse
408
- self.clearCachedHelpMessage = function () {
409
- cachedHelpMessage = undefined;
410
- };
411
- // given a set of keys, place any keys that are
412
- // ungrouped under the 'Options:' grouping.
413
- function addUngroupedKeys(keys, aliases, groups, defaultGroup) {
414
- let groupedKeys = [];
415
- let toCheck = null;
416
- Object.keys(groups).forEach((group) => {
417
- groupedKeys = groupedKeys.concat(groups[group]);
418
- });
419
- keys.forEach((key) => {
420
- toCheck = [key].concat(aliases[key]);
421
- if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) {
422
- groups[defaultGroup].push(key);
423
- }
424
- });
425
- return groupedKeys;
426
- }
427
- function filterHiddenOptions(key) {
428
- return yargs.getOptions().hiddenOptions.indexOf(key) < 0 || yargs.parsed.argv[yargs.getOptions().showHiddenOpt];
429
- }
430
- self.showHelp = (level) => {
431
- const logger = yargs._getLoggerInstance();
432
- if (!level)
433
- level = 'error';
434
- const emit = typeof level === 'function' ? level : logger[level];
435
- emit(self.help());
436
- };
437
- self.functionDescription = (fn) => {
438
- const description = fn.name ? decamelize(fn.name, '-') : __('generated-value');
439
- return ['(', description, ')'].join('');
440
- };
441
- self.stringifiedValues = function stringifiedValues(values, separator) {
442
- let string = '';
443
- const sep = separator || ', ';
444
- const array = [].concat(values);
445
- if (!values || !array.length)
446
- return string;
447
- array.forEach((value) => {
448
- if (string.length)
449
- string += sep;
450
- string += JSON.stringify(value);
451
- });
452
- return string;
453
- };
454
- // format the default-value-string displayed in
455
- // the right-hand column.
456
- function defaultString(value, defaultDescription) {
457
- let string = `[${__('default:')} `;
458
- if (value === undefined && !defaultDescription)
459
- return null;
460
- if (defaultDescription) {
461
- string += defaultDescription;
462
- }
463
- else {
464
- switch (typeof value) {
465
- case 'string':
466
- string += `"${value}"`;
467
- break;
468
- case 'object':
469
- string += JSON.stringify(value);
470
- break;
471
- default:
472
- string += value;
473
- }
474
- }
475
- return `${string}]`;
476
- }
477
- // guess the width of the console window, max-width 80.
478
- function windowWidth() {
479
- const maxWidth = 80;
480
- // CI is not a TTY
481
- /* c8 ignore next 2 */
482
- if (typeof process === 'object' && process.stdout && process.stdout.columns) {
483
- return Math.min(maxWidth, process.stdout.columns);
484
- }
485
- else {
486
- return maxWidth;
487
- }
488
- }
489
- // logic for displaying application version.
490
- let version = null;
491
- self.version = (ver) => {
492
- version = ver;
493
- };
494
- self.showVersion = () => {
495
- const logger = yargs._getLoggerInstance();
496
- logger.log(version);
497
- };
498
- self.reset = function reset(localLookup) {
499
- // do not reset wrap here
500
- // do not reset fails here
501
- failMessage = null;
502
- failureOutput = false;
503
- usages = [];
504
- usageDisabled = false;
505
- epilogs = [];
506
- examples = [];
507
- commands = [];
508
- descriptions = obj_filter_1.objFilter(descriptions, k => !localLookup[k]);
509
- return self;
510
- };
511
- const frozens = [];
512
- self.freeze = function freeze() {
513
- frozens.push({
514
- failMessage,
515
- failureOutput,
516
- usages,
517
- usageDisabled,
518
- epilogs,
519
- examples,
520
- commands,
521
- descriptions
522
- });
523
- };
524
- self.unfreeze = function unfreeze() {
525
- const frozen = frozens.pop();
526
- common_types_1.assertNotStrictEqual(frozen, undefined);
527
- ({
528
- failMessage,
529
- failureOutput,
530
- usages,
531
- usageDisabled,
532
- epilogs,
533
- examples,
534
- commands,
535
- descriptions
536
- } = frozen);
537
- };
538
- return self;
539
- }
540
- exports.usage = usage;
@@ -1,34 +0,0 @@
1
- import { Dictionary } from './common-types';
2
- import { UsageInstance } from './usage';
3
- import { YargsInstance, Arguments } from './yargs';
4
- import { DetailedArguments } from 'yargs-parser';
5
- import { Y18N } from 'y18n';
6
- export declare function validation(yargs: YargsInstance, usage: UsageInstance, y18n: Y18N): ValidationInstance;
7
- /** Instance of the validation module. */
8
- export interface ValidationInstance {
9
- check(f: CustomCheck['func'], global: boolean): void;
10
- conflicting(argv: Arguments): void;
11
- conflicts(key: string | Dictionary<string | string[]>, value?: string | string[]): void;
12
- customChecks(argv: Arguments, aliases: DetailedArguments['aliases']): void;
13
- freeze(): void;
14
- getConflicting(): Dictionary<(string | undefined)[]>;
15
- getImplied(): Dictionary<KeyOrPos[]>;
16
- implications(argv: Arguments): void;
17
- implies(key: string | Dictionary<KeyOrPos | KeyOrPos[]>, value?: KeyOrPos | KeyOrPos[]): void;
18
- isValidAndSomeAliasIsNotNew(key: string, aliases: DetailedArguments['aliases']): boolean;
19
- limitedChoices(argv: Arguments): void;
20
- nonOptionCount(argv: Arguments): void;
21
- positionalCount(required: number, observed: number): void;
22
- recommendCommands(cmd: string, potentialCommands: string[]): void;
23
- requiredArguments(argv: Arguments): void;
24
- reset(localLookup: Dictionary): ValidationInstance;
25
- unfreeze(): void;
26
- unknownArguments(argv: Arguments, aliases: DetailedArguments['aliases'], positionalMap: Dictionary, isDefaultCommand: boolean): void;
27
- unknownCommands(argv: Arguments): boolean;
28
- }
29
- interface CustomCheck {
30
- func: (argv: Arguments, aliases: DetailedArguments['aliases']) => any;
31
- global: boolean;
32
- }
33
- export declare type KeyOrPos = string | number;
34
- export {};