@pnp/cli-microsoft365 7.2.0-beta.194fd07 → 7.2.0-beta.41f58dd

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 (303) hide show
  1. package/.devcontainer/Dockerfile +0 -1
  2. package/.eslintrc.cjs +2 -0
  3. package/Dockerfile +0 -1
  4. package/allCommands.json +1 -0
  5. package/allCommandsFull.json +1 -0
  6. package/dist/Auth.js +1 -1
  7. package/dist/Command.js +7 -24
  8. package/dist/api.js +5 -7
  9. package/dist/chili/chili.js +40 -51
  10. package/dist/cli/Cli.js +120 -130
  11. package/dist/cli/timings.js +9 -0
  12. package/dist/index.js +8 -14
  13. package/dist/m365/aad/commands/administrativeunit/administrativeunit-add.js +3 -3
  14. package/dist/m365/aad/commands/administrativeunit/administrativeunit-get.js +2 -15
  15. package/dist/m365/aad/commands/administrativeunit/administrativeunit-remove.js +5 -22
  16. package/dist/m365/aad/commands/app/app-remove.js +2 -7
  17. package/dist/m365/aad/commands/app/app-role-remove.js +2 -7
  18. package/dist/m365/aad/commands/approleassignment/approleassignment-remove.js +2 -7
  19. package/dist/m365/aad/commands/group/group-remove.js +2 -7
  20. package/dist/m365/aad/commands/groupsetting/groupsetting-remove.js +2 -7
  21. package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-clear.js +2 -7
  22. package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-remove.js +2 -7
  23. package/dist/m365/aad/commands/m365group/m365group-remove.js +2 -7
  24. package/dist/m365/aad/commands/m365group/m365group-user-remove.js +2 -7
  25. package/dist/m365/aad/commands/oauth2grant/oauth2grant-remove.js +2 -7
  26. package/dist/m365/aad/commands/siteclassification/siteclassification-disable.js +2 -7
  27. package/dist/m365/aad/commands/user/user-license-remove.js +2 -7
  28. package/dist/m365/aad/commands/user/user-recyclebinitem-clear.js +2 -7
  29. package/dist/m365/aad/commands/user/user-recyclebinitem-remove.js +2 -7
  30. package/dist/m365/aad/commands/user/user-remove.js +2 -7
  31. package/dist/m365/cli/commands/config/config-set.js +5 -0
  32. package/dist/m365/commands/login.js +12 -8
  33. package/dist/m365/commands/setup.js +31 -37
  34. package/dist/m365/context/commands/context-remove.js +2 -7
  35. package/dist/m365/context/commands/option/option-remove.js +2 -7
  36. package/dist/m365/{search/commands/externalconnection/externalconnection-add.js → external/commands/connection/connection-add.js} +16 -13
  37. package/dist/m365/{search/commands/externalconnection/externalconnection-get.js → external/commands/connection/connection-get.js} +16 -13
  38. package/dist/m365/{search/commands/externalconnection/externalconnection-list.js → external/commands/connection/connection-list.js} +7 -4
  39. package/dist/m365/{search/commands/externalconnection/externalconnection-remove.js → external/commands/connection/connection-remove.js} +19 -21
  40. package/dist/m365/{search/commands/externalconnection/externalconnection-schema-add.js → external/commands/connection/connection-schema-add.js} +14 -11
  41. package/dist/m365/external/commands.js +15 -0
  42. package/dist/m365/flow/commands/environment/environment-list.js +6 -4
  43. package/dist/m365/flow/commands/flow-remove.js +2 -7
  44. package/dist/m365/flow/commands/owner/owner-remove.js +2 -7
  45. package/dist/m365/flow/commands/run/run-cancel.js +2 -7
  46. package/dist/m365/flow/commands/run/run-resubmit.js +2 -7
  47. package/dist/m365/graph/commands/schemaextension/schemaextension-remove.js +2 -7
  48. package/dist/m365/pa/commands/app/app-consent-set.js +2 -7
  49. package/dist/m365/pa/commands/app/app-permission-remove.js +2 -7
  50. package/dist/m365/pa/commands/app/app-remove.js +2 -7
  51. package/dist/m365/planner/commands/bucket/bucket-remove.js +2 -7
  52. package/dist/m365/planner/commands/plan/plan-remove.js +2 -7
  53. package/dist/m365/planner/commands/roster/roster-member-remove.js +4 -14
  54. package/dist/m365/planner/commands/roster/roster-remove.js +2 -7
  55. package/dist/m365/planner/commands/task/task-checklistitem-remove.js +2 -7
  56. package/dist/m365/planner/commands/task/task-reference-remove.js +2 -7
  57. package/dist/m365/planner/commands/task/task-remove.js +2 -7
  58. package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-remove.js +2 -7
  59. package/dist/m365/pp/commands/card/card-remove.js +2 -7
  60. package/dist/m365/pp/commands/chatbot/chatbot-remove.js +2 -7
  61. package/dist/m365/pp/commands/dataverse/dataverse-table-remove.js +2 -7
  62. package/dist/m365/pp/commands/dataverse/dataverse-table-row-remove.js +2 -7
  63. package/dist/m365/pp/commands/solution/solution-publisher-remove.js +2 -7
  64. package/dist/m365/pp/commands/solution/solution-remove.js +2 -7
  65. package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +2 -7
  66. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +2 -7
  67. package/dist/m365/purview/commands/retentionlabel/retentionlabel-remove.js +2 -7
  68. package/dist/m365/spfx/commands/project/DeployWorkflow.js +4 -4
  69. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.1.js +21 -0
  70. package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
  71. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +17 -0
  72. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014010_CODE_settings_filesexclude_jest.js +44 -0
  73. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.18.1.js +57 -0
  74. package/dist/m365/spfx/commands/project/project-upgrade.js +2 -1
  75. package/dist/m365/spfx/commands/spfx-doctor.js +15 -0
  76. package/dist/m365/spo/commands/app/app-remove.js +2 -7
  77. package/dist/m365/spo/commands/app/app-retract.js +2 -7
  78. package/dist/m365/spo/commands/app/app-uninstall.js +2 -7
  79. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +2 -7
  80. package/dist/m365/spo/commands/cdn/cdn-origin-remove.js +2 -7
  81. package/dist/m365/spo/commands/commandset/commandset-remove.js +2 -7
  82. package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +2 -7
  83. package/dist/m365/spo/commands/contenttype/contenttype-remove.js +2 -2
  84. package/dist/m365/spo/commands/customaction/customaction-clear.js +2 -7
  85. package/dist/m365/spo/commands/customaction/customaction-remove.js +2 -7
  86. package/dist/m365/spo/commands/eventreceiver/eventreceiver-remove.js +2 -7
  87. package/dist/m365/spo/commands/field/field-remove.js +2 -7
  88. package/dist/m365/spo/commands/file/file-checkout-undo.js +2 -7
  89. package/dist/m365/spo/commands/file/file-remove.js +2 -7
  90. package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +14 -23
  91. package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +21 -34
  92. package/dist/m365/spo/commands/file/file-roleassignment-remove.js +2 -7
  93. package/dist/m365/spo/commands/file/file-roleinheritance-break.js +2 -7
  94. package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +2 -7
  95. package/dist/m365/spo/commands/file/file-sharinglink-clear.js +2 -7
  96. package/dist/m365/spo/commands/file/file-sharinglink-remove.js +2 -7
  97. package/dist/m365/spo/commands/file/file-version-clear.js +2 -7
  98. package/dist/m365/spo/commands/file/file-version-remove.js +2 -7
  99. package/dist/m365/spo/commands/file/file-version-restore.js +2 -7
  100. package/dist/m365/spo/commands/folder/folder-remove.js +2 -7
  101. package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +9 -29
  102. package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +11 -35
  103. package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +2 -7
  104. package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +2 -7
  105. package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +2 -7
  106. package/dist/m365/spo/commands/group/group-member-remove.js +2 -7
  107. package/dist/m365/spo/commands/group/group-remove.js +2 -7
  108. package/dist/m365/spo/commands/homesite/homesite-remove.js +2 -7
  109. package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +2 -7
  110. package/dist/m365/spo/commands/hubsite/hubsite-rights-revoke.js +2 -7
  111. package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +2 -7
  112. package/dist/m365/spo/commands/knowledgehub/knowledgehub-remove.js +2 -7
  113. package/dist/m365/spo/commands/list/list-contenttype-remove.js +2 -7
  114. package/dist/m365/spo/commands/list/list-remove.js +2 -7
  115. package/dist/m365/spo/commands/list/list-retentionlabel-ensure.js +27 -37
  116. package/dist/m365/spo/commands/list/list-retentionlabel-remove.js +8 -26
  117. package/dist/m365/spo/commands/list/list-roleassignment-remove.js +2 -7
  118. package/dist/m365/spo/commands/list/list-roleinheritance-break.js +2 -7
  119. package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +2 -7
  120. package/dist/m365/spo/commands/list/list-view-field-remove.js +2 -7
  121. package/dist/m365/spo/commands/list/list-view-remove.js +2 -7
  122. package/dist/m365/spo/commands/list/list-webhook-remove.js +2 -7
  123. package/dist/m365/spo/commands/listitem/listitem-attachment-remove.js +2 -7
  124. package/dist/m365/spo/commands/listitem/listitem-remove.js +2 -7
  125. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-ensure.js +36 -37
  126. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +38 -39
  127. package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +2 -7
  128. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +2 -7
  129. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +2 -7
  130. package/dist/m365/spo/commands/navigation/navigation-node-remove.js +2 -7
  131. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-remove.js +2 -7
  132. package/dist/m365/spo/commands/orgnewssite/orgnewssite-remove.js +2 -7
  133. package/dist/m365/spo/commands/page/page-remove.js +2 -7
  134. package/dist/m365/spo/commands/propertybag/propertybag-remove.js +2 -7
  135. package/dist/m365/spo/commands/roledefinition/roledefinition-remove.js +2 -7
  136. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-revoke.js +49 -12
  137. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-set.js +2 -7
  138. package/dist/m365/spo/commands/site/site-add.js +45 -12
  139. package/dist/m365/spo/commands/site/site-apppermission-remove.js +2 -7
  140. package/dist/m365/spo/commands/site/site-hubsite-disconnect.js +2 -7
  141. package/dist/m365/spo/commands/site/site-recyclebinitem-clear.js +2 -7
  142. package/dist/m365/spo/commands/site/site-recyclebinitem-move.js +2 -7
  143. package/dist/m365/spo/commands/site/site-recyclebinitem-remove.js +2 -7
  144. package/dist/m365/spo/commands/site/site-remove.js +2 -7
  145. package/dist/m365/spo/commands/site/site-set.js +33 -1
  146. package/dist/m365/spo/commands/sitedesign/sitedesign-remove.js +2 -7
  147. package/dist/m365/spo/commands/sitedesign/sitedesign-rights-revoke.js +2 -7
  148. package/dist/m365/spo/commands/sitedesign/sitedesign-task-remove.js +2 -7
  149. package/dist/m365/spo/commands/sitescript/sitescript-get.js +8 -2
  150. package/dist/m365/spo/commands/sitescript/sitescript-remove.js +2 -7
  151. package/dist/m365/spo/commands/storageentity/storageentity-remove.js +2 -7
  152. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +2 -7
  153. package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +2 -7
  154. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +2 -7
  155. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +19 -2
  156. package/dist/m365/spo/commands/theme/theme-remove.js +2 -7
  157. package/dist/m365/spo/commands/user/user-remove.js +2 -7
  158. package/dist/m365/spo/commands/web/web-remove.js +2 -7
  159. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +2 -7
  160. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +2 -7
  161. package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +2 -7
  162. package/dist/m365/teams/commands/app/app-remove.js +2 -7
  163. package/dist/m365/teams/commands/app/app-uninstall.js +2 -7
  164. package/dist/m365/teams/commands/cache/cache-remove.js +2 -7
  165. package/dist/m365/teams/commands/channel/channel-member-remove.js +2 -7
  166. package/dist/m365/teams/commands/channel/channel-remove.js +2 -7
  167. package/dist/m365/teams/commands/chat/chat-member-remove.js +2 -7
  168. package/dist/m365/teams/commands/tab/tab-remove.js +2 -7
  169. package/dist/m365/teams/commands/team/team-remove.js +2 -7
  170. package/dist/m365/teams/commands/user/user-app-remove.js +19 -11
  171. package/dist/m365/tenant/commands/people/people-profilecardproperty-add.js +131 -0
  172. package/dist/m365/tenant/commands/people/people-profilecardproperty-get.js +75 -0
  173. package/dist/m365/tenant/commands/people/people-profilecardproperty-list.js +53 -0
  174. package/dist/m365/tenant/commands/people/people-profilecardproperty-remove.js +79 -0
  175. package/dist/m365/tenant/commands/people/people-profilecardproperty-set.js +118 -0
  176. package/dist/m365/tenant/commands/people/profileCardProperties.js +24 -0
  177. package/dist/m365/tenant/commands.js +5 -0
  178. package/dist/m365/todo/commands/list/list-remove.js +2 -7
  179. package/dist/m365/todo/commands/task/task-remove.js +2 -7
  180. package/dist/m365/yammer/commands/group/group-user-remove.js +2 -7
  181. package/dist/m365/yammer/commands/message/message-like-set.js +3 -8
  182. package/dist/m365/yammer/commands/message/message-remove.js +2 -7
  183. package/dist/request.js +6 -0
  184. package/dist/settingsNames.js +1 -0
  185. package/dist/utils/aadAdministrativeUnit.js +25 -0
  186. package/dist/utils/prompt.js +26 -7
  187. package/dist/utils/spo.js +109 -0
  188. package/docs/docs/_clisettings.mdx +1 -0
  189. package/docs/docs/cmd/aad/administrativeunit/administrativeunit-add.mdx +6 -2
  190. package/docs/docs/cmd/aad/administrativeunit/administrativeunit-get.mdx +5 -1
  191. package/docs/docs/cmd/aad/administrativeunit/administrativeunit-list.mdx +5 -1
  192. package/docs/docs/cmd/aad/administrativeunit/administrativeunit-remove.mdx +6 -2
  193. package/docs/docs/cmd/aad/approleassignment/approleassignment-add.mdx +1 -1
  194. package/docs/docs/cmd/aad/approleassignment/approleassignment-list.mdx +2 -2
  195. package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.mdx +1 -1
  196. package/docs/docs/cmd/aad/oauth2grant/oauth2grant-add.mdx +1 -1
  197. package/docs/docs/cmd/aad/oauth2grant/oauth2grant-list.mdx +2 -2
  198. package/docs/docs/cmd/aad/oauth2grant/oauth2grant-remove.mdx +2 -2
  199. package/docs/docs/cmd/aad/oauth2grant/oauth2grant-set.mdx +2 -2
  200. package/docs/docs/cmd/aad/policy/policy-list.mdx +1 -1
  201. package/docs/docs/cmd/aad/siteclassification/siteclassification-disable.mdx +1 -1
  202. package/docs/docs/cmd/aad/siteclassification/siteclassification-enable.mdx +1 -1
  203. package/docs/docs/cmd/aad/siteclassification/siteclassification-get.mdx +1 -1
  204. package/docs/docs/cmd/aad/siteclassification/siteclassification-set.mdx +1 -1
  205. package/docs/docs/cmd/aad/sp/sp-add.mdx +2 -2
  206. package/docs/docs/cmd/aad/sp/sp-get.mdx +2 -2
  207. package/docs/docs/cmd/aad/user/user-add.mdx +3 -3
  208. package/docs/docs/cmd/aad/user/user-guest-add.mdx +1 -1
  209. package/docs/docs/cmd/aad/user/user-set.mdx +3 -3
  210. package/docs/docs/cmd/{search/externalconnection/externalconnection-add.mdx → external/connection/connection-add.mdx} +16 -10
  211. package/docs/docs/cmd/{search/externalconnection/externalconnection-get.mdx → external/connection/connection-get.mdx} +16 -11
  212. package/docs/docs/cmd/{search/externalconnection/externalconnection-list.mdx → external/connection/connection-list.mdx} +12 -7
  213. package/docs/docs/cmd/external/connection/connection-remove.mdx +54 -0
  214. package/docs/docs/cmd/external/connection/connection-schema-add.mdx +41 -0
  215. package/docs/docs/cmd/graph/changelog/changelog-list.mdx +5 -5
  216. package/docs/docs/cmd/login.mdx +1 -1
  217. package/docs/docs/cmd/onenote/notebook/notebook-list.mdx +1 -1
  218. package/docs/docs/cmd/outlook/message/message-list.mdx +1 -1
  219. package/docs/docs/cmd/outlook/message/message-move.mdx +1 -1
  220. package/docs/docs/cmd/planner/bucket/bucket-add.mdx +1 -1
  221. package/docs/docs/cmd/planner/bucket/bucket-set.mdx +1 -1
  222. package/docs/docs/cmd/planner/plan/plan-set.mdx +3 -3
  223. package/docs/docs/cmd/planner/task/task-set.mdx +1 -1
  224. package/docs/docs/cmd/purview/auditlog/auditlog-list.mdx +3 -3
  225. package/docs/docs/cmd/purview/retentionevent/retentionevent-add.mdx +1 -1
  226. package/docs/docs/cmd/purview/retentionevent/retentionevent-get.mdx +1 -1
  227. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.mdx +1 -1
  228. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.mdx +1 -1
  229. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-remove.mdx +1 -1
  230. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-set.mdx +1 -1
  231. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.mdx +1 -1
  232. package/docs/docs/cmd/purview/sensitivitylabel/sensitivitylabel-policysettings-list.mdx +4 -4
  233. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
  234. package/docs/docs/cmd/spo/app/app-add.mdx +1 -1
  235. package/docs/docs/cmd/spo/app/app-deploy.mdx +1 -1
  236. package/docs/docs/cmd/spo/app/app-get.mdx +1 -1
  237. package/docs/docs/cmd/spo/app/app-install.mdx +1 -1
  238. package/docs/docs/cmd/spo/app/app-list.mdx +1 -1
  239. package/docs/docs/cmd/spo/app/app-remove.mdx +1 -1
  240. package/docs/docs/cmd/spo/app/app-retract.mdx +1 -1
  241. package/docs/docs/cmd/spo/app/app-uninstall.mdx +1 -1
  242. package/docs/docs/cmd/spo/app/app-upgrade.mdx +1 -1
  243. package/docs/docs/cmd/spo/contenttype/contenttype-add.mdx +1 -1
  244. package/docs/docs/cmd/spo/contenttype/contenttype-set.mdx +1 -1
  245. package/docs/docs/cmd/spo/file/file-rename.mdx +2 -0
  246. package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-get.mdx +1 -1
  247. package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-set.mdx +1 -1
  248. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-revoke.mdx +10 -1
  249. package/docs/docs/cmd/spo/site/site-add.mdx +25 -4
  250. package/docs/docs/cmd/spo/site/site-appcatalog-add.mdx +1 -1
  251. package/docs/docs/cmd/spo/site/site-appcatalog-remove.mdx +1 -1
  252. package/docs/docs/cmd/spo/site/site-groupify.mdx +1 -1
  253. package/docs/docs/cmd/spo/site/site-set.mdx +15 -0
  254. package/docs/docs/cmd/spo/sitedesign/sitedesign-add.mdx +3 -3
  255. package/docs/docs/cmd/spo/sitedesign/sitedesign-apply.mdx +1 -1
  256. package/docs/docs/cmd/spo/sitedesign/sitedesign-get.mdx +1 -1
  257. package/docs/docs/cmd/spo/sitedesign/sitedesign-list.mdx +1 -1
  258. package/docs/docs/cmd/spo/sitedesign/sitedesign-remove.mdx +1 -1
  259. package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-grant.mdx +1 -1
  260. package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-list.mdx +1 -1
  261. package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-revoke.mdx +1 -1
  262. package/docs/docs/cmd/spo/sitedesign/sitedesign-run-list.mdx +1 -1
  263. package/docs/docs/cmd/spo/sitedesign/sitedesign-run-status-get.mdx +1 -1
  264. package/docs/docs/cmd/spo/sitedesign/sitedesign-set.mdx +3 -3
  265. package/docs/docs/cmd/spo/sitedesign/sitedesign-task-get.mdx +1 -1
  266. package/docs/docs/cmd/spo/sitedesign/sitedesign-task-list.mdx +1 -1
  267. package/docs/docs/cmd/spo/sitedesign/sitedesign-task-remove.mdx +1 -1
  268. package/docs/docs/cmd/spo/sitescript/sitescript-add.mdx +1 -1
  269. package/docs/docs/cmd/spo/sitescript/sitescript-get.mdx +73 -3
  270. package/docs/docs/cmd/spo/sitescript/sitescript-list.mdx +1 -1
  271. package/docs/docs/cmd/spo/sitescript/sitescript-remove.mdx +1 -1
  272. package/docs/docs/cmd/spo/sitescript/sitescript-set.mdx +1 -1
  273. package/docs/docs/cmd/spo/storageentity/storageentity-get.mdx +1 -1
  274. package/docs/docs/cmd/spo/storageentity/storageentity-list.mdx +1 -1
  275. package/docs/docs/cmd/spo/storageentity/storageentity-remove.mdx +1 -1
  276. package/docs/docs/cmd/spo/storageentity/storageentity-set.mdx +1 -1
  277. package/docs/docs/cmd/spo/theme/theme-apply.mdx +1 -1
  278. package/docs/docs/cmd/spo/theme/theme-get.mdx +1 -1
  279. package/docs/docs/cmd/spo/theme/theme-list.mdx +1 -1
  280. package/docs/docs/cmd/spo/theme/theme-remove.mdx +1 -1
  281. package/docs/docs/cmd/spo/user/user-remove.mdx +1 -1
  282. package/docs/docs/cmd/spo/web/web-set.mdx +1 -1
  283. package/docs/docs/cmd/teams/channel/channel-remove.mdx +1 -1
  284. package/docs/docs/cmd/teams/meeting/meeting-get.mdx +1 -1
  285. package/docs/docs/cmd/teams/meeting/meeting-transcript-list.mdx +1 -1
  286. package/docs/docs/cmd/teams/report/report-pstncalls.mdx +1 -1
  287. package/docs/docs/cmd/teams/tab/tab-remove.mdx +1 -1
  288. package/docs/docs/cmd/teams/team/team-remove.mdx +1 -1
  289. package/docs/docs/cmd/teams/user/user-app-remove.mdx +11 -2
  290. package/docs/docs/cmd/tenant/people/people-profilecardproperty-add.mdx +126 -0
  291. package/docs/docs/cmd/tenant/people/people-profilecardproperty-get.mdx +101 -0
  292. package/docs/docs/cmd/tenant/people/people-profilecardproperty-list.mdx +98 -0
  293. package/docs/docs/cmd/tenant/people/people-profilecardproperty-remove.mdx +61 -0
  294. package/docs/docs/cmd/tenant/people/people-profilecardproperty-set.mdx +120 -0
  295. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.mdx +1 -1
  296. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.mdx +1 -1
  297. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.mdx +1 -1
  298. package/docs/docs/cmd/todo/task/task-set.mdx +1 -1
  299. package/npm-shrinkwrap.json +603 -563
  300. package/package.json +36 -36
  301. package/dist/m365/search/commands.js +0 -9
  302. package/docs/docs/cmd/search/externalconnection/externalconnection-remove.mdx +0 -48
  303. package/docs/docs/cmd/search/externalconnection/externalconnection-schema-add.mdx +0 -35
package/dist/Auth.js CHANGED
@@ -341,7 +341,7 @@ export class Auth {
341
341
  const cli = Cli.getInstance();
342
342
  cli.spinner.text = response.message;
343
343
  cli.spinner.spinner = {
344
- frames: ['🌶️']
344
+ frames: ['🌶️ ']
345
345
  };
346
346
  // don't show spinner if running tests
347
347
  /* c8 ignore next 3 */
package/dist/Command.js CHANGED
@@ -89,11 +89,8 @@ class Command {
89
89
  prompted = true;
90
90
  Cli.error('🌶️ Provide values for the following parameters:');
91
91
  }
92
- const missingRequireOptionValue = await prompt.forInput({
93
- name: 'missingRequireOptionValue',
94
- message: `${command.options[i].name}: `
95
- }).then(result => result.missingRequireOptionValue);
96
- args.options[command.options[i].name] = missingRequireOptionValue;
92
+ const answer = await prompt.forInput({ message: `${command.options[i].name}: ` });
93
+ args.options[command.options[i].name] = answer;
97
94
  }
98
95
  if (prompted) {
99
96
  Cli.error('');
@@ -130,29 +127,15 @@ class Command {
130
127
  }
131
128
  async promptForOptionSetNameAndValue(args, optionSet) {
132
129
  Cli.error(`🌶️ Please specify one of the following options:`);
133
- const resultOptionName = await prompt.forInput({
134
- type: 'list',
135
- name: 'missingRequiredOptionName',
136
- message: `Option to use:`,
137
- choices: optionSet.options
138
- });
139
- const missingRequiredOptionName = resultOptionName.missingRequiredOptionName;
140
- const resultOptionValue = await prompt.forInput({
141
- name: 'missingRequiredOptionValue',
142
- message: `${missingRequiredOptionName}:`
143
- });
144
- args.options[missingRequiredOptionName] = resultOptionValue.missingRequiredOptionValue;
130
+ const selectedOptionName = await prompt.forSelection({ message: `Option to use:`, choices: optionSet.options.map((choice) => { return { name: choice, value: choice }; }) });
131
+ const optionValue = await prompt.forInput({ message: `${selectedOptionName}:` });
132
+ args.options[selectedOptionName] = optionValue;
145
133
  Cli.error('');
146
134
  }
147
135
  async promptForSpecificOption(args, commonOptions) {
148
136
  Cli.error(`🌶️ Multiple options for an option set specified. Please specify the correct option that you wish to use.`);
149
- const requiredOptionNameResult = await prompt.forInput({
150
- type: 'list',
151
- name: 'missingRequiredOptionName',
152
- message: `Option to use:`,
153
- choices: commonOptions
154
- });
155
- commonOptions.filter(y => y !== requiredOptionNameResult.missingRequiredOptionName).map(optionName => args.options[optionName] = undefined);
137
+ const selectedOptionName = await prompt.forSelection({ message: `Option to use:`, choices: commonOptions.map((choice) => { return { name: choice, value: choice }; }) });
138
+ commonOptions.filter(y => y !== selectedOptionName).map(optionName => args.options[optionName] = undefined);
156
139
  Cli.error('');
157
140
  }
158
141
  async validateOutput(args) {
package/dist/api.js CHANGED
@@ -1,13 +1,11 @@
1
1
  import { Cli } from "./cli/Cli.js";
2
- import path from 'path';
3
- export function executeCommand(commandName, options, listener) {
2
+ export async function executeCommand(commandName, options, listener) {
4
3
  const cli = Cli.getInstance();
5
- cli.commandsFolder = path.join(__dirname, 'm365');
6
- cli.commands = [];
7
- cli.loadCommandFromArgs(commandName.split(' '));
8
- if (cli.commands.length !== 1) {
4
+ cli.loadAllCommandsInfo();
5
+ await cli.loadCommandFromArgs(commandName.split(' '));
6
+ if (!cli.commandToExecute) {
9
7
  return Promise.reject(`Command not found: ${commandName}`);
10
8
  }
11
- return Cli.executeCommandWithOutput(cli.commands[0].command, { options: options ?? {} }, listener);
9
+ return Cli.executeCommandWithOutput(cli.commandToExecute.command, { options: options ?? {} }, listener);
12
10
  }
13
11
  //# sourceMappingURL=api.js.map
@@ -1,5 +1,4 @@
1
1
  import fs from 'fs';
2
- import inquirer from 'inquirer';
3
2
  import ora from 'ora';
4
3
  import path from 'path';
5
4
  import url from 'url';
@@ -7,6 +6,7 @@ import { Cli } from '../cli/Cli.js';
7
6
  import request from '../request.js';
8
7
  import { settingsNames } from '../settingsNames.js';
9
8
  import { md } from '../utils/md.js';
9
+ import { prompt } from '../utils/prompt.js';
10
10
  const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
11
11
  const mendableApiKey = 'd3313d54-6f8e-40e0-90d3-4095019d4be7';
12
12
  let showHelp = false;
@@ -79,12 +79,7 @@ async function startConversation(args) {
79
79
  await runConversationTurn(conversationId, initialPrompt);
80
80
  }
81
81
  async function promptForPrompt() {
82
- const answer = await inquirer.prompt([{
83
- type: 'input',
84
- name: 'prompt',
85
- message: '🌶️ How can I help you?'
86
- }]);
87
- return answer.prompt;
82
+ return await prompt.forInput({ message: '🌶️ How can I help you?' });
88
83
  }
89
84
  async function runConversationTurn(conversationId, question) {
90
85
  console.log('');
@@ -120,60 +115,54 @@ async function runConversationTurn(conversationId, question) {
120
115
  }
121
116
  console.log('');
122
117
  }
123
- const result = await inquirer.prompt([{
124
- type: 'list',
125
- name: 'chat',
126
- message: 'What would you like to do next?',
127
- choices: [
128
- {
129
- name: '📝 I want to know more',
130
- value: 'ask'
131
- },
132
- {
133
- name: '👋 I know enough. Thanks!',
134
- value: 'end'
135
- },
136
- {
137
- name: '🔄 I want to ask about something else',
138
- value: 'new'
139
- }
140
- ]
141
- }]);
142
- switch (result.chat) {
118
+ const choices = [
119
+ {
120
+ name: '📝 I want to know more',
121
+ value: 'ask'
122
+ },
123
+ {
124
+ name: '👋 I know enough. Thanks!',
125
+ value: 'end'
126
+ },
127
+ {
128
+ name: '🔄 I want to ask about something else',
129
+ value: 'new'
130
+ }
131
+ ];
132
+ const result = await prompt.forSelection({ message: 'What would you like to do next?', choices });
133
+ switch (result) {
143
134
  case 'ask':
144
135
  const prompt = await promptForPrompt();
145
- return await runConversationTurn(conversationId, prompt);
136
+ await runConversationTurn(conversationId, prompt);
137
+ break;
146
138
  case 'end':
147
139
  await endConversation(conversationId);
148
140
  console.log('');
149
141
  console.log('🌶️ Bye!');
150
- return;
142
+ break;
151
143
  case 'new':
152
144
  initialPrompt = '';
153
- return startConversation([]);
145
+ await startConversation([]);
146
+ break;
154
147
  }
155
148
  }
156
149
  async function rateResponse(messageId) {
157
- const result = await inquirer.prompt([{
158
- type: 'list',
159
- name: 'rating',
160
- message: 'Was this helpful?',
161
- choices: [
162
- {
163
- name: '👍 Yes',
164
- value: 1
165
- },
166
- {
167
- name: '👎 No',
168
- value: -1
169
- },
170
- {
171
- name: '🤔 Not sure/skip',
172
- value: 0
173
- }
174
- ]
175
- }]);
176
- if (result.rating === 0) {
150
+ const choices = [
151
+ {
152
+ name: '👍 Yes',
153
+ value: 1
154
+ },
155
+ {
156
+ name: '👎 No',
157
+ value: -1
158
+ },
159
+ {
160
+ name: '🤔 Not sure/skip',
161
+ value: 0
162
+ }
163
+ ];
164
+ const rating = await prompt.forSelection({ message: 'Was this helpful?', choices });
165
+ if (rating === 0) {
177
166
  return;
178
167
  }
179
168
  console.log('Thanks for letting us know! 😊');
@@ -192,7 +181,7 @@ async function rateResponse(messageId) {
192
181
  // eslint-disable-next-line camelcase
193
182
  message_id: messageId,
194
183
  // eslint-disable-next-line camelcase
195
- rating_value: result.rating
184
+ rating_value: rating
196
185
  }
197
186
  };
198
187
  const spinner = ora('Sending rating...');
package/dist/cli/Cli.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import Configstore from 'configstore';
2
2
  import fs from 'fs';
3
3
  import minimist from 'minimist';
4
+ import { createRequire } from 'module';
4
5
  import ora from 'ora';
5
6
  import os from 'os';
6
7
  import path from 'path';
7
- import { pathToFileURL } from 'url';
8
+ import { fileURLToPath, pathToFileURL } from 'url';
8
9
  import Command, { CommandError } from '../Command.js';
9
10
  import config from '../config.js';
10
11
  import request from '../request.js';
@@ -12,10 +13,12 @@ import { settingsNames } from '../settingsNames.js';
12
13
  import { telemetry } from '../telemetry.js';
13
14
  import { app } from '../utils/app.js';
14
15
  import { formatting } from '../utils/formatting.js';
15
- import { fsUtil } from '../utils/fsUtil.js';
16
16
  import { md } from '../utils/md.js';
17
17
  import { validation } from '../utils/validation.js';
18
18
  import { prompt } from '../utils/prompt.js';
19
+ import { timings } from './timings.js';
20
+ const require = createRequire(import.meta.url);
21
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
19
22
  export class Cli {
20
23
  get config() {
21
24
  if (!this._config) {
@@ -34,7 +37,6 @@ export class Cli {
34
37
  }
35
38
  constructor() {
36
39
  this.commands = [];
37
- this.commandsFolder = '';
38
40
  const options = {
39
41
  text: 'Running command...',
40
42
  /* c8 ignore next 1 */
@@ -48,8 +50,11 @@ export class Cli {
48
50
  }
49
51
  return Cli.instance;
50
52
  }
51
- async execute(commandsFolder, rawArgs) {
52
- this.commandsFolder = commandsFolder;
53
+ async execute(rawArgs) {
54
+ const start = process.hrtime.bigint();
55
+ // for completion commands we also need information about commands' options
56
+ const loadAllCommandInfo = rawArgs.indexOf('completion') > -1;
57
+ this.loadAllCommandsInfo(loadAllCommandInfo);
53
58
  // check if help for a specific command has been requested using the
54
59
  // 'm365 help xyz' format. If so, remove 'help' from the array of words
55
60
  // to use lazy loading commands but keep track of the fact that help should
@@ -59,22 +64,10 @@ export class Cli {
59
64
  showHelp = true;
60
65
  rawArgs.shift();
61
66
  }
62
- // parse args to see if a command has been specified and can be loaded
63
- // rather than loading all commands
67
+ // parse args to see if a command has been specified
64
68
  const parsedArgs = minimist(rawArgs);
65
- // load commands
69
+ // load command
66
70
  await this.loadCommandFromArgs(parsedArgs._);
67
- if (this.currentCommandName) {
68
- for (let i = 0; i < this.commands.length; i++) {
69
- const command = this.commands[i];
70
- if (command.name === this.currentCommandName ||
71
- (command.aliases &&
72
- command.aliases.indexOf(this.currentCommandName) > -1)) {
73
- this.commandToExecute = command;
74
- break;
75
- }
76
- }
77
- }
78
71
  if (this.commandToExecute) {
79
72
  // we have found a command to execute. Parse args again taking into
80
73
  // account short and long options, option types and whether the command
@@ -90,6 +83,8 @@ export class Cli {
90
83
  }
91
84
  }
92
85
  else {
86
+ // we need this to properly support displaying commands
87
+ // from the current group
93
88
  this.optionsFromArgs = {
94
89
  options: parsedArgs
95
90
  };
@@ -113,26 +108,56 @@ export class Cli {
113
108
  catch (e) {
114
109
  return this.closeWithError(e, optionsWithoutShorts);
115
110
  }
111
+ const startProcessing = process.hrtime.bigint();
116
112
  try {
117
113
  // process options before passing them on to validation stage
118
114
  const contextCommandOptions = await this.loadOptionsFromContext(this.commandToExecute.options, optionsWithoutShorts.options.debug);
119
115
  optionsWithoutShorts.options = { ...contextCommandOptions, ...optionsWithoutShorts.options };
120
116
  await this.commandToExecute.command.processOptions(optionsWithoutShorts.options);
117
+ const endProcessing = process.hrtime.bigint();
118
+ timings.options.push(Number(endProcessing - startProcessing));
121
119
  }
122
120
  catch (e) {
121
+ const endProcessing = process.hrtime.bigint();
122
+ timings.options.push(Number(endProcessing - startProcessing));
123
123
  return this.closeWithError(e.message, optionsWithoutShorts, false);
124
124
  }
125
125
  // if output not specified, set the configured output value (if any)
126
126
  if (optionsWithoutShorts.options.output === undefined) {
127
127
  optionsWithoutShorts.options.output = this.getSettingWithDefaultValue(settingsNames.output, 'json');
128
128
  }
129
+ const startValidation = process.hrtime.bigint();
129
130
  const validationResult = await this.commandToExecute.command.validate(optionsWithoutShorts, this.commandToExecute);
131
+ const endValidation = process.hrtime.bigint();
132
+ timings.validation.push(Number(endValidation - startValidation));
130
133
  if (validationResult !== true) {
131
134
  return this.closeWithError(validationResult, optionsWithoutShorts, true);
132
135
  }
133
- return Cli
134
- .executeCommand(this.commandToExecute.command, optionsWithoutShorts)
135
- .then(_ => process.exit(0), err => this.closeWithError(err, optionsWithoutShorts));
136
+ const end = process.hrtime.bigint();
137
+ timings.core.push(Number(end - start));
138
+ try {
139
+ await Cli.executeCommand(this.commandToExecute.command, optionsWithoutShorts);
140
+ const endTotal = process.hrtime.bigint();
141
+ timings.total.push(Number(endTotal - start));
142
+ this.printTimings(rawArgs);
143
+ process.exit(0);
144
+ }
145
+ catch (err) {
146
+ const endTotal = process.hrtime.bigint();
147
+ timings.total.push(Number(endTotal - start));
148
+ this.printTimings(rawArgs);
149
+ await this.closeWithError(err, optionsWithoutShorts);
150
+ /* c8 ignore next */
151
+ }
152
+ }
153
+ printTimings(rawArgs) {
154
+ if (rawArgs.some(arg => arg === '--debug')) {
155
+ Cli.error('');
156
+ Cli.error('Timings:');
157
+ Object.getOwnPropertyNames(timings).forEach(key => {
158
+ Cli.error(`${key}: ${timings[key].reduce((a, b) => a + b, 0) / 1e6}ms`);
159
+ });
160
+ }
136
161
  }
137
162
  static async executeCommand(command, args) {
138
163
  const logger = {
@@ -167,6 +192,7 @@ export class Cli {
167
192
  if (showSpinner && typeof global.it === 'undefined') {
168
193
  cli.spinner.start();
169
194
  }
195
+ const startCommand = process.hrtime.bigint();
170
196
  try {
171
197
  await command.action(logger, args);
172
198
  if (args.options.debug || args.options.verbose) {
@@ -181,6 +207,8 @@ export class Cli {
181
207
  if (cli.spinner.isSpinning) {
182
208
  cli.spinner.stop();
183
209
  }
210
+ const endCommand = process.hrtime.bigint();
211
+ timings.command.push(Number(endCommand - startCommand));
184
212
  }
185
213
  }
186
214
  static async executeCommandWithOutput(command, args, listener) {
@@ -248,55 +276,26 @@ export class Cli {
248
276
  request.logger = currentLogger;
249
277
  }
250
278
  }
251
- async loadAllCommands() {
252
- const files = fsUtil.readdirR(this.commandsFolder);
253
- await Promise.all(files.map(async (filePath) => {
254
- const file = pathToFileURL(filePath).toString();
255
- if (file.indexOf(`/commands/`) > -1 &&
256
- file.indexOf(`/assets/`) < 0 &&
257
- file.endsWith('.js') &&
258
- !file.endsWith('.spec.js')) {
259
- try {
260
- const command = await import(file);
261
- if (command.default instanceof Command) {
262
- this.loadCommand(command.default);
263
- }
264
- }
265
- catch (e) {
266
- this.closeWithError(e, { options: {} });
267
- }
268
- }
269
- }));
279
+ loadAllCommandsInfo(loadFull = false) {
280
+ const commandsInfoFileName = loadFull ? 'allCommandsFull.json' : 'allCommands.json';
281
+ this.commands = require(path.join(__dirname, '..', '..', commandsInfoFileName));
270
282
  }
271
283
  /**
272
284
  * Loads command files into CLI based on the specified arguments.
273
285
  *
274
286
  * @param commandNameWords Array of words specified as args
275
- */
287
+ */
276
288
  async loadCommandFromArgs(commandNameWords) {
277
- this.currentCommandName = commandNameWords.join(' ');
278
289
  if (commandNameWords.length === 0) {
279
- await this.loadAllCommands();
280
- return;
281
- }
282
- const isCompletionCommand = commandNameWords.indexOf('completion') > -1;
283
- if (isCompletionCommand) {
284
- await this.loadAllCommands();
285
290
  return;
286
291
  }
287
- let commandFilePath = '';
288
- if (commandNameWords.length === 1) {
289
- commandFilePath = path.join(this.commandsFolder, 'commands', `${commandNameWords[0]}.js`);
290
- }
291
- else {
292
- if (commandNameWords.length === 2) {
293
- commandFilePath = path.join(this.commandsFolder, commandNameWords[0], 'commands', `${commandNameWords.join('-')}.js`);
294
- }
295
- else {
296
- commandFilePath = path.join(this.commandsFolder, commandNameWords[0], 'commands', commandNameWords[1], commandNameWords.slice(1).join('-') + '.js');
297
- }
292
+ this.currentCommandName = commandNameWords.join(' ');
293
+ const commandFilePath = this.commands
294
+ .find(c => c.name === this.currentCommandName ||
295
+ c.aliases?.find(a => a === this.currentCommandName))?.file ?? '';
296
+ if (commandFilePath) {
297
+ await this.loadCommandFromFile(commandFilePath);
298
298
  }
299
- await this.loadCommandFromFile(commandFilePath);
300
299
  }
301
300
  async loadOptionsFromContext(commandOptions, debug) {
302
301
  const filePath = '.m365rc.json';
@@ -339,39 +338,37 @@ export class Cli {
339
338
  * Loads command from the specified file into CLI. If can't find the file
340
339
  * or the file doesn't contain a command, loads all available commands.
341
340
  *
342
- * @param commandFilePath File path of the file with command to load
341
+ * @param commandFilePathUrl File path of the file with command to load
343
342
  */
344
- async loadCommandFromFile(commandFilePath) {
345
- if (!fs.existsSync(commandFilePath)) {
346
- await this.loadAllCommands();
343
+ async loadCommandFromFile(commandFileUrl) {
344
+ const commandsFolder = path.join(__dirname, '../m365');
345
+ const filePath = path.join(commandsFolder, commandFileUrl);
346
+ if (!fs.existsSync(filePath)) {
347
+ // reset command name
348
+ this.currentCommandName = undefined;
347
349
  return;
348
350
  }
349
351
  try {
350
- const commandFileUrl = pathToFileURL(commandFilePath).toString();
351
- const command = await import(commandFileUrl);
352
+ const command = await import(pathToFileURL(filePath).toString());
352
353
  if (command.default instanceof Command) {
353
- this.loadCommand(command.default);
354
- }
355
- else {
356
- await this.loadAllCommands();
354
+ const commandInfo = this.commands.find(c => c.file === commandFileUrl);
355
+ this.commandToExecute = Cli.getCommandInfo(command.default, commandFileUrl, commandInfo?.help);
357
356
  }
358
357
  }
359
- catch {
360
- await this.loadAllCommands();
361
- }
358
+ catch { }
362
359
  }
363
- static getCommandInfo(command) {
360
+ static getCommandInfo(command, filePath = '', helpFilePath = '') {
364
361
  return {
365
362
  aliases: command.alias(),
366
363
  name: command.name,
364
+ description: command.description,
367
365
  command: command,
368
366
  options: this.getCommandOptions(command),
369
- defaultProperties: command.defaultProperties()
367
+ defaultProperties: command.defaultProperties(),
368
+ file: filePath,
369
+ help: helpFilePath
370
370
  };
371
371
  }
372
- loadCommand(command) {
373
- this.commands.push(Cli.getCommandInfo(command));
374
- }
375
372
  static getCommandOptions(command) {
376
373
  const options = [];
377
374
  command.options.forEach(option => {
@@ -568,58 +565,39 @@ export class Cli {
568
565
  process.exit(exitCode);
569
566
  }
570
567
  printCommandHelp(helpMode) {
571
- let helpFilePath = '';
572
- let commandNameWords = [];
573
- if (this.commandToExecute) {
574
- commandNameWords = (this.commandToExecute.name).split(' ');
575
- }
576
- const pathChunks = [this.commandsFolder, '..', '..', 'docs', 'docs', 'cmd'];
577
- if (commandNameWords.length === 1) {
578
- pathChunks.push(`${commandNameWords[0]}.mdx`);
579
- }
580
- else {
581
- if (commandNameWords.length === 2) {
582
- pathChunks.push(commandNameWords[0], `${commandNameWords.join('-')}.mdx`);
583
- }
584
- else {
585
- pathChunks.push(commandNameWords[0], commandNameWords[1], commandNameWords.slice(1).join('-') + '.mdx');
586
- }
587
- }
588
- helpFilePath = path.join(...pathChunks);
568
+ const docsRootDir = path.join(__dirname, '..', '..', 'docs');
569
+ const helpFilePath = path.join(docsRootDir, 'docs', 'cmd', this.commandToExecute.help);
589
570
  if (fs.existsSync(helpFilePath)) {
590
571
  let helpContents = fs.readFileSync(helpFilePath, 'utf8');
591
572
  helpContents = this.getHelpSection(helpMode, helpContents);
592
- helpContents = md.md2plain(helpContents, path.join(this.commandsFolder, '..', '..', 'docs'));
573
+ helpContents = md.md2plain(helpContents, docsRootDir);
593
574
  Cli.log();
594
575
  Cli.log(helpContents);
595
576
  }
596
577
  }
597
578
  async getHelpMode(options) {
598
- const h = options.h;
599
- const help = options.help;
579
+ const { h, help } = options;
580
+ if (!h && !help) {
581
+ return this.getSettingWithDefaultValue(settingsNames.helpMode, Cli.defaultHelpMode);
582
+ }
600
583
  // user passed -h or --help, let's see if they passed a specific mode
601
584
  // or requested the default
602
- if (h || help) {
603
- const helpMode = h ?? help;
604
- if (typeof helpMode === 'boolean' || typeof helpMode !== 'string') {
605
- // requested default mode or passed a number, let's use default
606
- return this.getSettingWithDefaultValue(settingsNames.helpMode, Cli.defaultHelpMode);
585
+ const helpMode = h ?? help;
586
+ if (typeof helpMode === 'boolean' || typeof helpMode !== 'string') {
587
+ // requested default mode or passed a number, let's use default
588
+ return this.getSettingWithDefaultValue(settingsNames.helpMode, Cli.defaultHelpMode);
589
+ }
590
+ else {
591
+ const lowerCaseHelpMode = helpMode.toLowerCase();
592
+ if (Cli.helpModes.indexOf(lowerCaseHelpMode) < 0) {
593
+ await Cli.getInstance().closeWithError(`Unknown help mode ${helpMode}. Allowed values are ${Cli.helpModes.join(', ')}`, { options }, false);
594
+ /* c8 ignore next 2 */
595
+ return ''; // noop
607
596
  }
608
597
  else {
609
- const lowerCaseHelpMode = helpMode.toLowerCase();
610
- if (Cli.helpModes.indexOf(lowerCaseHelpMode) < 0) {
611
- await Cli.getInstance().closeWithError(`Unknown help mode ${helpMode}. Allowed values are ${Cli.helpModes.join(', ')}`, { options }, false);
612
- /* c8 ignore next 2 */
613
- return ''; // noop
614
- }
615
- else {
616
- return lowerCaseHelpMode;
617
- }
598
+ return lowerCaseHelpMode;
618
599
  }
619
600
  }
620
- else {
621
- return this.getSettingWithDefaultValue(settingsNames.helpMode, Cli.defaultHelpMode);
622
- }
623
601
  }
624
602
  getHelpSection(helpMode, helpContents) {
625
603
  if (helpMode === 'full') {
@@ -709,7 +687,7 @@ export class Cli {
709
687
  Cli.log();
710
688
  const sortedCommandNamesToPrint = Object.getOwnPropertyNames(commandsToPrint).sort();
711
689
  sortedCommandNamesToPrint.forEach(commandName => {
712
- Cli.log(` ${`${commandName} [options]`.padEnd(maxLength, ' ')} ${commandsToPrint[commandName].command.description}`);
690
+ Cli.log(` ${`${commandName} [options]`.padEnd(maxLength, ' ')} ${commandsToPrint[commandName].description}`);
713
691
  });
714
692
  }
715
693
  const namesOfCommandGroupsToPrint = Object.keys(commandGroupsToPrint);
@@ -804,35 +782,47 @@ export class Cli {
804
782
  cli.spinner.start();
805
783
  }
806
784
  }
807
- static async prompt(options, answers) {
785
+ static async promptForSelection(config) {
786
+ const cli = Cli.getInstance();
787
+ const spinnerSpinning = cli.spinner.isSpinning;
788
+ /* c8 ignore next 3 */
789
+ if (spinnerSpinning) {
790
+ cli.spinner.stop();
791
+ }
792
+ const answer = await prompt.forSelection(config);
793
+ Cli.error('');
794
+ // Restart the spinner if it was running before the prompt
795
+ /* c8 ignore next 3 */
796
+ if (spinnerSpinning) {
797
+ cli.spinner.start();
798
+ }
799
+ return answer;
800
+ }
801
+ static async promptForConfirmation(config) {
808
802
  const cli = Cli.getInstance();
809
803
  const spinnerSpinning = cli.spinner.isSpinning;
810
804
  /* c8 ignore next 3 */
811
805
  if (spinnerSpinning) {
812
806
  cli.spinner.stop();
813
807
  }
814
- const response = await prompt.forInput(options, answers);
808
+ const answer = await prompt.forConfirmation(config);
809
+ Cli.error('');
815
810
  // Restart the spinner if it was running before the prompt
816
811
  /* c8 ignore next 3 */
817
812
  if (spinnerSpinning) {
818
813
  cli.spinner.start();
819
814
  }
820
- return response;
815
+ return answer;
821
816
  }
822
817
  static async handleMultipleResultsFound(message, values) {
823
818
  const prompt = Cli.getInstance().getSettingWithDefaultValue(settingsNames.prompt, true);
824
819
  if (!prompt) {
825
820
  throw new Error(`${message} Found: ${Object.keys(values).join(', ')}.`);
826
821
  }
827
- const response = await Cli.prompt({
828
- type: 'list',
829
- name: 'select',
830
- default: 0,
831
- prefix: '🌶️ ',
832
- message: `${message} Please choose one:`,
833
- choices: Object.keys(values)
834
- });
835
- return values[response.select];
822
+ Cli.error(`🌶️ ${message}`);
823
+ const choices = Object.keys(values).map((choice) => { return { name: choice, value: choice }; });
824
+ const response = await Cli.promptForSelection({ message: `Please choose one:`, choices });
825
+ return values[response];
836
826
  }
837
827
  static removeShortOptions(args) {
838
828
  const filteredArgs = JSON.parse(JSON.stringify(args));
@@ -0,0 +1,9 @@
1
+ export const timings = {
2
+ api: [],
3
+ core: [],
4
+ command: [],
5
+ options: [],
6
+ total: [],
7
+ validation: []
8
+ };
9
+ //# sourceMappingURL=timings.js.map