@pnp/cli-microsoft365 7.2.0-beta.ba91bbd → 7.2.0-beta.d785eb6
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.
- package/.devcontainer/Dockerfile +0 -1
- package/.eslintrc.cjs +2 -0
- package/Dockerfile +0 -1
- package/allCommands.json +1 -0
- package/dist/Command.js +7 -24
- package/dist/api.js +5 -7
- package/dist/chili/chili.js +40 -51
- package/dist/cli/Cli.js +117 -130
- package/dist/cli/timings.js +9 -0
- package/dist/index.js +8 -14
- package/dist/m365/aad/commands/administrativeunit/administrativeunit-add.js +3 -3
- package/dist/m365/aad/commands/administrativeunit/administrativeunit-get.js +2 -15
- package/dist/m365/aad/commands/administrativeunit/administrativeunit-remove.js +5 -22
- package/dist/m365/aad/commands/app/app-remove.js +2 -7
- package/dist/m365/aad/commands/app/app-role-remove.js +2 -7
- package/dist/m365/aad/commands/approleassignment/approleassignment-remove.js +2 -7
- package/dist/m365/aad/commands/group/group-remove.js +2 -7
- package/dist/m365/aad/commands/groupsetting/groupsetting-remove.js +2 -7
- package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-clear.js +2 -7
- package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-remove.js +2 -7
- package/dist/m365/aad/commands/m365group/m365group-remove.js +2 -7
- package/dist/m365/aad/commands/m365group/m365group-user-remove.js +2 -7
- package/dist/m365/aad/commands/oauth2grant/oauth2grant-remove.js +2 -7
- package/dist/m365/aad/commands/siteclassification/siteclassification-disable.js +2 -7
- package/dist/m365/aad/commands/user/user-license-remove.js +2 -7
- package/dist/m365/aad/commands/user/user-recyclebinitem-clear.js +2 -7
- package/dist/m365/aad/commands/user/user-recyclebinitem-remove.js +2 -7
- package/dist/m365/aad/commands/user/user-remove.js +2 -7
- package/dist/m365/commands/setup.js +31 -37
- package/dist/m365/context/commands/context-remove.js +2 -7
- package/dist/m365/context/commands/option/option-remove.js +2 -7
- package/dist/m365/{search/commands/externalconnection/externalconnection-add.js → external/commands/connection/connection-add.js} +16 -13
- package/dist/m365/{search/commands/externalconnection/externalconnection-get.js → external/commands/connection/connection-get.js} +16 -13
- package/dist/m365/{search/commands/externalconnection/externalconnection-list.js → external/commands/connection/connection-list.js} +7 -4
- package/dist/m365/{search/commands/externalconnection/externalconnection-remove.js → external/commands/connection/connection-remove.js} +19 -21
- package/dist/m365/{search/commands/externalconnection/externalconnection-schema-add.js → external/commands/connection/connection-schema-add.js} +14 -11
- package/dist/m365/external/commands.js +15 -0
- package/dist/m365/flow/commands/environment/environment-list.js +6 -4
- package/dist/m365/flow/commands/flow-remove.js +2 -7
- package/dist/m365/flow/commands/owner/owner-remove.js +2 -7
- package/dist/m365/flow/commands/run/run-cancel.js +2 -7
- package/dist/m365/flow/commands/run/run-resubmit.js +2 -7
- package/dist/m365/graph/commands/schemaextension/schemaextension-remove.js +2 -7
- package/dist/m365/pa/commands/app/app-consent-set.js +2 -7
- package/dist/m365/pa/commands/app/app-permission-remove.js +2 -7
- package/dist/m365/pa/commands/app/app-remove.js +2 -7
- package/dist/m365/planner/commands/bucket/bucket-remove.js +2 -7
- package/dist/m365/planner/commands/plan/plan-remove.js +2 -7
- package/dist/m365/planner/commands/roster/roster-member-remove.js +4 -14
- package/dist/m365/planner/commands/roster/roster-remove.js +2 -7
- package/dist/m365/planner/commands/task/task-checklistitem-remove.js +2 -7
- package/dist/m365/planner/commands/task/task-reference-remove.js +2 -7
- package/dist/m365/planner/commands/task/task-remove.js +2 -7
- package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-remove.js +2 -7
- package/dist/m365/pp/commands/card/card-remove.js +2 -7
- package/dist/m365/pp/commands/chatbot/chatbot-remove.js +2 -7
- package/dist/m365/pp/commands/dataverse/dataverse-table-remove.js +2 -7
- package/dist/m365/pp/commands/dataverse/dataverse-table-row-remove.js +2 -7
- package/dist/m365/pp/commands/solution/solution-publisher-remove.js +2 -7
- package/dist/m365/pp/commands/solution/solution-remove.js +2 -7
- package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +2 -7
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +2 -7
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-remove.js +2 -7
- package/dist/m365/spfx/commands/project/DeployWorkflow.js +4 -4
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.1.js +21 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +17 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014010_CODE_settings_filesexclude_jest.js +44 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.18.1.js +57 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +2 -1
- package/dist/m365/spfx/commands/spfx-doctor.js +15 -0
- package/dist/m365/spo/commands/app/app-remove.js +2 -7
- package/dist/m365/spo/commands/app/app-retract.js +2 -7
- package/dist/m365/spo/commands/app/app-uninstall.js +2 -7
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +2 -7
- package/dist/m365/spo/commands/cdn/cdn-origin-remove.js +2 -7
- package/dist/m365/spo/commands/commandset/commandset-remove.js +2 -7
- package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +2 -7
- package/dist/m365/spo/commands/contenttype/contenttype-remove.js +2 -2
- package/dist/m365/spo/commands/customaction/customaction-clear.js +2 -7
- package/dist/m365/spo/commands/customaction/customaction-remove.js +2 -7
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-remove.js +2 -7
- package/dist/m365/spo/commands/field/field-remove.js +2 -7
- package/dist/m365/spo/commands/file/file-checkout-undo.js +2 -7
- package/dist/m365/spo/commands/file/file-remove.js +2 -7
- package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +2 -7
- package/dist/m365/spo/commands/file/file-roleassignment-remove.js +2 -7
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +2 -7
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +2 -7
- package/dist/m365/spo/commands/file/file-sharinglink-clear.js +2 -7
- package/dist/m365/spo/commands/file/file-sharinglink-remove.js +2 -7
- package/dist/m365/spo/commands/file/file-version-clear.js +2 -7
- package/dist/m365/spo/commands/file/file-version-remove.js +2 -7
- package/dist/m365/spo/commands/file/file-version-restore.js +2 -7
- package/dist/m365/spo/commands/folder/folder-remove.js +2 -7
- package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +2 -7
- package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +2 -7
- package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +2 -7
- package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +2 -7
- package/dist/m365/spo/commands/group/group-member-remove.js +2 -7
- package/dist/m365/spo/commands/group/group-remove.js +2 -7
- package/dist/m365/spo/commands/homesite/homesite-remove.js +2 -7
- package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +2 -7
- package/dist/m365/spo/commands/hubsite/hubsite-rights-revoke.js +2 -7
- package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +2 -7
- package/dist/m365/spo/commands/knowledgehub/knowledgehub-remove.js +2 -7
- package/dist/m365/spo/commands/list/list-contenttype-remove.js +2 -7
- package/dist/m365/spo/commands/list/list-remove.js +2 -7
- package/dist/m365/spo/commands/list/list-retentionlabel-remove.js +2 -7
- package/dist/m365/spo/commands/list/list-roleassignment-remove.js +2 -7
- package/dist/m365/spo/commands/list/list-roleinheritance-break.js +2 -7
- package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +2 -7
- package/dist/m365/spo/commands/list/list-view-field-remove.js +2 -7
- package/dist/m365/spo/commands/list/list-view-remove.js +2 -7
- package/dist/m365/spo/commands/list/list-webhook-remove.js +2 -7
- package/dist/m365/spo/commands/listitem/listitem-attachment-remove.js +2 -7
- package/dist/m365/spo/commands/listitem/listitem-remove.js +2 -7
- package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +2 -7
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +2 -7
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +2 -7
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +2 -7
- package/dist/m365/spo/commands/navigation/navigation-node-remove.js +2 -7
- package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-remove.js +2 -7
- package/dist/m365/spo/commands/orgnewssite/orgnewssite-remove.js +2 -7
- package/dist/m365/spo/commands/page/page-remove.js +2 -7
- package/dist/m365/spo/commands/propertybag/propertybag-remove.js +2 -7
- package/dist/m365/spo/commands/roledefinition/roledefinition-remove.js +2 -7
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-set.js +2 -7
- package/dist/m365/spo/commands/site/site-add.js +45 -12
- package/dist/m365/spo/commands/site/site-apppermission-remove.js +2 -7
- package/dist/m365/spo/commands/site/site-hubsite-disconnect.js +2 -7
- package/dist/m365/spo/commands/site/site-recyclebinitem-clear.js +2 -7
- package/dist/m365/spo/commands/site/site-recyclebinitem-move.js +2 -7
- package/dist/m365/spo/commands/site/site-recyclebinitem-remove.js +2 -7
- package/dist/m365/spo/commands/site/site-remove.js +2 -7
- package/dist/m365/spo/commands/site/site-set.js +33 -1
- package/dist/m365/spo/commands/sitedesign/sitedesign-remove.js +2 -7
- package/dist/m365/spo/commands/sitedesign/sitedesign-rights-revoke.js +2 -7
- package/dist/m365/spo/commands/sitedesign/sitedesign-task-remove.js +2 -7
- package/dist/m365/spo/commands/sitescript/sitescript-remove.js +2 -7
- package/dist/m365/spo/commands/storageentity/storageentity-remove.js +2 -7
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +2 -7
- package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +2 -7
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +2 -7
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +19 -2
- package/dist/m365/spo/commands/theme/theme-remove.js +2 -7
- package/dist/m365/spo/commands/user/user-remove.js +2 -7
- package/dist/m365/spo/commands/web/web-remove.js +2 -7
- package/dist/m365/spo/commands/web/web-roleassignment-remove.js +2 -7
- package/dist/m365/spo/commands/web/web-roleinheritance-break.js +2 -7
- package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +2 -7
- package/dist/m365/teams/commands/app/app-remove.js +2 -7
- package/dist/m365/teams/commands/app/app-uninstall.js +2 -7
- package/dist/m365/teams/commands/cache/cache-remove.js +2 -7
- package/dist/m365/teams/commands/channel/channel-member-remove.js +2 -7
- package/dist/m365/teams/commands/channel/channel-remove.js +2 -7
- package/dist/m365/teams/commands/chat/chat-member-remove.js +2 -7
- package/dist/m365/teams/commands/tab/tab-remove.js +2 -7
- package/dist/m365/teams/commands/team/team-remove.js +2 -7
- package/dist/m365/teams/commands/user/user-app-remove.js +19 -11
- package/dist/m365/tenant/commands/people/people-profilecardproperty-add.js +131 -0
- package/dist/m365/tenant/commands/people/people-profilecardproperty-get.js +75 -0
- package/dist/m365/tenant/commands/people/people-profilecardproperty-list.js +53 -0
- package/dist/m365/tenant/commands/people/people-profilecardproperty-remove.js +79 -0
- package/dist/m365/tenant/commands/people/people-profilecardproperty-set.js +118 -0
- package/dist/m365/tenant/commands/people/profileCardProperties.js +24 -0
- package/dist/m365/tenant/commands.js +5 -0
- package/dist/m365/todo/commands/list/list-remove.js +2 -7
- package/dist/m365/todo/commands/task/task-remove.js +2 -7
- package/dist/m365/yammer/commands/group/group-user-remove.js +2 -7
- package/dist/m365/yammer/commands/message/message-like-set.js +3 -8
- package/dist/m365/yammer/commands/message/message-remove.js +2 -7
- package/dist/request.js +6 -0
- package/dist/utils/aadAdministrativeUnit.js +25 -0
- package/dist/utils/prompt.js +26 -7
- package/docs/docs/cmd/aad/administrativeunit/administrativeunit-add.mdx +6 -2
- package/docs/docs/cmd/aad/administrativeunit/administrativeunit-get.mdx +5 -1
- package/docs/docs/cmd/aad/administrativeunit/administrativeunit-list.mdx +5 -1
- package/docs/docs/cmd/aad/administrativeunit/administrativeunit-remove.mdx +6 -2
- package/docs/docs/cmd/aad/approleassignment/approleassignment-add.mdx +1 -1
- package/docs/docs/cmd/aad/approleassignment/approleassignment-list.mdx +2 -2
- package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.mdx +1 -1
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-add.mdx +1 -1
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-list.mdx +2 -2
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-remove.mdx +2 -2
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-set.mdx +2 -2
- package/docs/docs/cmd/aad/policy/policy-list.mdx +1 -1
- package/docs/docs/cmd/aad/siteclassification/siteclassification-disable.mdx +1 -1
- package/docs/docs/cmd/aad/siteclassification/siteclassification-enable.mdx +1 -1
- package/docs/docs/cmd/aad/siteclassification/siteclassification-get.mdx +1 -1
- package/docs/docs/cmd/aad/siteclassification/siteclassification-set.mdx +1 -1
- package/docs/docs/cmd/aad/sp/sp-add.mdx +2 -2
- package/docs/docs/cmd/aad/sp/sp-get.mdx +2 -2
- package/docs/docs/cmd/aad/user/user-add.mdx +3 -3
- package/docs/docs/cmd/aad/user/user-guest-add.mdx +1 -1
- package/docs/docs/cmd/aad/user/user-set.mdx +3 -3
- package/docs/docs/cmd/{search/externalconnection/externalconnection-add.mdx → external/connection/connection-add.mdx} +16 -10
- package/docs/docs/cmd/{search/externalconnection/externalconnection-get.mdx → external/connection/connection-get.mdx} +16 -11
- package/docs/docs/cmd/{search/externalconnection/externalconnection-list.mdx → external/connection/connection-list.mdx} +12 -7
- package/docs/docs/cmd/external/connection/connection-remove.mdx +54 -0
- package/docs/docs/cmd/external/connection/connection-schema-add.mdx +41 -0
- package/docs/docs/cmd/graph/changelog/changelog-list.mdx +5 -5
- package/docs/docs/cmd/onenote/notebook/notebook-list.mdx +1 -1
- package/docs/docs/cmd/outlook/message/message-list.mdx +1 -1
- package/docs/docs/cmd/outlook/message/message-move.mdx +1 -1
- package/docs/docs/cmd/planner/bucket/bucket-add.mdx +1 -1
- package/docs/docs/cmd/planner/bucket/bucket-set.mdx +1 -1
- package/docs/docs/cmd/planner/plan/plan-set.mdx +3 -3
- package/docs/docs/cmd/planner/task/task-set.mdx +1 -1
- package/docs/docs/cmd/purview/auditlog/auditlog-list.mdx +3 -3
- package/docs/docs/cmd/purview/retentionevent/retentionevent-add.mdx +1 -1
- package/docs/docs/cmd/purview/retentionevent/retentionevent-get.mdx +1 -1
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.mdx +1 -1
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.mdx +1 -1
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-remove.mdx +1 -1
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-set.mdx +1 -1
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.mdx +1 -1
- package/docs/docs/cmd/purview/sensitivitylabel/sensitivitylabel-policysettings-list.mdx +4 -4
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-add.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-deploy.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-get.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-install.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-list.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-remove.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-retract.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-uninstall.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-add.mdx +1 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-set.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-rename.mdx +2 -0
- package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-get.mdx +1 -1
- package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-set.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-add.mdx +25 -4
- package/docs/docs/cmd/spo/site/site-appcatalog-add.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-appcatalog-remove.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-groupify.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-set.mdx +15 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-add.mdx +3 -3
- package/docs/docs/cmd/spo/sitedesign/sitedesign-apply.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-get.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-list.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-remove.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-grant.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-list.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-revoke.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-run-list.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-run-status-get.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-set.mdx +3 -3
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-get.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-list.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-remove.mdx +1 -1
- package/docs/docs/cmd/spo/sitescript/sitescript-add.mdx +1 -1
- package/docs/docs/cmd/spo/sitescript/sitescript-get.mdx +1 -1
- package/docs/docs/cmd/spo/sitescript/sitescript-list.mdx +1 -1
- package/docs/docs/cmd/spo/sitescript/sitescript-remove.mdx +1 -1
- package/docs/docs/cmd/spo/sitescript/sitescript-set.mdx +1 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-get.mdx +1 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-list.mdx +1 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-remove.mdx +1 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-set.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-apply.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-get.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-list.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-remove.mdx +1 -1
- package/docs/docs/cmd/spo/user/user-remove.mdx +1 -1
- package/docs/docs/cmd/spo/web/web-set.mdx +1 -1
- package/docs/docs/cmd/teams/channel/channel-remove.mdx +1 -1
- package/docs/docs/cmd/teams/meeting/meeting-get.mdx +1 -1
- package/docs/docs/cmd/teams/meeting/meeting-transcript-list.mdx +1 -1
- package/docs/docs/cmd/teams/report/report-pstncalls.mdx +1 -1
- package/docs/docs/cmd/teams/tab/tab-remove.mdx +1 -1
- package/docs/docs/cmd/teams/team/team-remove.mdx +1 -1
- package/docs/docs/cmd/teams/user/user-app-remove.mdx +11 -2
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-add.mdx +126 -0
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-get.mdx +101 -0
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-list.mdx +98 -0
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-remove.mdx +61 -0
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-set.mdx +120 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.mdx +1 -1
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.mdx +1 -1
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.mdx +1 -1
- package/docs/docs/cmd/todo/task/task-set.mdx +1 -1
- package/npm-shrinkwrap.json +603 -563
- package/package.json +30 -32
- package/dist/m365/search/commands.js +0 -9
- package/docs/docs/cmd/search/externalconnection/externalconnection-remove.mdx +0 -48
- package/docs/docs/cmd/search/externalconnection/externalconnection-schema-add.mdx +0 -35
package/dist/api.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { Cli } from "./cli/Cli.js";
|
|
2
|
-
|
|
3
|
-
export function executeCommand(commandName, options, listener) {
|
|
2
|
+
export async function executeCommand(commandName, options, listener) {
|
|
4
3
|
const cli = Cli.getInstance();
|
|
5
|
-
cli.
|
|
6
|
-
cli.
|
|
7
|
-
cli.
|
|
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.
|
|
9
|
+
return Cli.executeCommandWithOutput(cli.commandToExecute.command, { options: options ?? {} }, listener);
|
|
12
10
|
}
|
|
13
11
|
//# sourceMappingURL=api.js.map
|
package/dist/chili/chili.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
124
|
-
|
|
125
|
-
name: '
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
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
|
-
|
|
142
|
+
break;
|
|
151
143
|
case 'new':
|
|
152
144
|
initialPrompt = '';
|
|
153
|
-
|
|
145
|
+
await startConversation([]);
|
|
146
|
+
break;
|
|
154
147
|
}
|
|
155
148
|
}
|
|
156
149
|
async function rateResponse(messageId) {
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
name: '
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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:
|
|
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,9 @@ export class Cli {
|
|
|
48
50
|
}
|
|
49
51
|
return Cli.instance;
|
|
50
52
|
}
|
|
51
|
-
async execute(
|
|
52
|
-
|
|
53
|
+
async execute(rawArgs) {
|
|
54
|
+
const start = process.hrtime.bigint();
|
|
55
|
+
this.loadAllCommandsInfo();
|
|
53
56
|
// check if help for a specific command has been requested using the
|
|
54
57
|
// 'm365 help xyz' format. If so, remove 'help' from the array of words
|
|
55
58
|
// to use lazy loading commands but keep track of the fact that help should
|
|
@@ -59,22 +62,10 @@ export class Cli {
|
|
|
59
62
|
showHelp = true;
|
|
60
63
|
rawArgs.shift();
|
|
61
64
|
}
|
|
62
|
-
// parse args to see if a command has been specified
|
|
63
|
-
// rather than loading all commands
|
|
65
|
+
// parse args to see if a command has been specified
|
|
64
66
|
const parsedArgs = minimist(rawArgs);
|
|
65
|
-
// load
|
|
67
|
+
// load command
|
|
66
68
|
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
69
|
if (this.commandToExecute) {
|
|
79
70
|
// we have found a command to execute. Parse args again taking into
|
|
80
71
|
// account short and long options, option types and whether the command
|
|
@@ -90,6 +81,8 @@ export class Cli {
|
|
|
90
81
|
}
|
|
91
82
|
}
|
|
92
83
|
else {
|
|
84
|
+
// we need this to properly support displaying commands
|
|
85
|
+
// from the current group
|
|
93
86
|
this.optionsFromArgs = {
|
|
94
87
|
options: parsedArgs
|
|
95
88
|
};
|
|
@@ -113,26 +106,56 @@ export class Cli {
|
|
|
113
106
|
catch (e) {
|
|
114
107
|
return this.closeWithError(e, optionsWithoutShorts);
|
|
115
108
|
}
|
|
109
|
+
const startProcessing = process.hrtime.bigint();
|
|
116
110
|
try {
|
|
117
111
|
// process options before passing them on to validation stage
|
|
118
112
|
const contextCommandOptions = await this.loadOptionsFromContext(this.commandToExecute.options, optionsWithoutShorts.options.debug);
|
|
119
113
|
optionsWithoutShorts.options = { ...contextCommandOptions, ...optionsWithoutShorts.options };
|
|
120
114
|
await this.commandToExecute.command.processOptions(optionsWithoutShorts.options);
|
|
115
|
+
const endProcessing = process.hrtime.bigint();
|
|
116
|
+
timings.options.push(Number(endProcessing - startProcessing));
|
|
121
117
|
}
|
|
122
118
|
catch (e) {
|
|
119
|
+
const endProcessing = process.hrtime.bigint();
|
|
120
|
+
timings.options.push(Number(endProcessing - startProcessing));
|
|
123
121
|
return this.closeWithError(e.message, optionsWithoutShorts, false);
|
|
124
122
|
}
|
|
125
123
|
// if output not specified, set the configured output value (if any)
|
|
126
124
|
if (optionsWithoutShorts.options.output === undefined) {
|
|
127
125
|
optionsWithoutShorts.options.output = this.getSettingWithDefaultValue(settingsNames.output, 'json');
|
|
128
126
|
}
|
|
127
|
+
const startValidation = process.hrtime.bigint();
|
|
129
128
|
const validationResult = await this.commandToExecute.command.validate(optionsWithoutShorts, this.commandToExecute);
|
|
129
|
+
const endValidation = process.hrtime.bigint();
|
|
130
|
+
timings.validation.push(Number(endValidation - startValidation));
|
|
130
131
|
if (validationResult !== true) {
|
|
131
132
|
return this.closeWithError(validationResult, optionsWithoutShorts, true);
|
|
132
133
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
const end = process.hrtime.bigint();
|
|
135
|
+
timings.core.push(Number(end - start));
|
|
136
|
+
try {
|
|
137
|
+
await Cli.executeCommand(this.commandToExecute.command, optionsWithoutShorts);
|
|
138
|
+
const endTotal = process.hrtime.bigint();
|
|
139
|
+
timings.total.push(Number(endTotal - start));
|
|
140
|
+
this.printTimings(rawArgs);
|
|
141
|
+
process.exit(0);
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
const endTotal = process.hrtime.bigint();
|
|
145
|
+
timings.total.push(Number(endTotal - start));
|
|
146
|
+
this.printTimings(rawArgs);
|
|
147
|
+
await this.closeWithError(err, optionsWithoutShorts);
|
|
148
|
+
/* c8 ignore next */
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
printTimings(rawArgs) {
|
|
152
|
+
if (rawArgs.some(arg => arg === '--debug')) {
|
|
153
|
+
Cli.error('');
|
|
154
|
+
Cli.error('Timings:');
|
|
155
|
+
Object.getOwnPropertyNames(timings).forEach(key => {
|
|
156
|
+
Cli.error(`${key}: ${timings[key].reduce((a, b) => a + b, 0) / 1e6}ms`);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
136
159
|
}
|
|
137
160
|
static async executeCommand(command, args) {
|
|
138
161
|
const logger = {
|
|
@@ -167,6 +190,7 @@ export class Cli {
|
|
|
167
190
|
if (showSpinner && typeof global.it === 'undefined') {
|
|
168
191
|
cli.spinner.start();
|
|
169
192
|
}
|
|
193
|
+
const startCommand = process.hrtime.bigint();
|
|
170
194
|
try {
|
|
171
195
|
await command.action(logger, args);
|
|
172
196
|
if (args.options.debug || args.options.verbose) {
|
|
@@ -181,6 +205,8 @@ export class Cli {
|
|
|
181
205
|
if (cli.spinner.isSpinning) {
|
|
182
206
|
cli.spinner.stop();
|
|
183
207
|
}
|
|
208
|
+
const endCommand = process.hrtime.bigint();
|
|
209
|
+
timings.command.push(Number(endCommand - startCommand));
|
|
184
210
|
}
|
|
185
211
|
}
|
|
186
212
|
static async executeCommandWithOutput(command, args, listener) {
|
|
@@ -248,55 +274,25 @@ export class Cli {
|
|
|
248
274
|
request.logger = currentLogger;
|
|
249
275
|
}
|
|
250
276
|
}
|
|
251
|
-
|
|
252
|
-
|
|
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
|
-
}));
|
|
277
|
+
loadAllCommandsInfo() {
|
|
278
|
+
this.commands = require(path.join(__dirname, '../../allCommands.json'));
|
|
270
279
|
}
|
|
271
280
|
/**
|
|
272
281
|
* Loads command files into CLI based on the specified arguments.
|
|
273
282
|
*
|
|
274
283
|
* @param commandNameWords Array of words specified as args
|
|
275
|
-
|
|
284
|
+
*/
|
|
276
285
|
async loadCommandFromArgs(commandNameWords) {
|
|
277
|
-
this.currentCommandName = commandNameWords.join(' ');
|
|
278
286
|
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
287
|
return;
|
|
286
288
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
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
|
-
}
|
|
289
|
+
this.currentCommandName = commandNameWords.join(' ');
|
|
290
|
+
const commandFilePath = this.commands
|
|
291
|
+
.find(c => c.name === this.currentCommandName ||
|
|
292
|
+
c.aliases?.find(a => a === this.currentCommandName))?.file ?? '';
|
|
293
|
+
if (commandFilePath) {
|
|
294
|
+
await this.loadCommandFromFile(commandFilePath);
|
|
298
295
|
}
|
|
299
|
-
await this.loadCommandFromFile(commandFilePath);
|
|
300
296
|
}
|
|
301
297
|
async loadOptionsFromContext(commandOptions, debug) {
|
|
302
298
|
const filePath = '.m365rc.json';
|
|
@@ -339,39 +335,37 @@ export class Cli {
|
|
|
339
335
|
* Loads command from the specified file into CLI. If can't find the file
|
|
340
336
|
* or the file doesn't contain a command, loads all available commands.
|
|
341
337
|
*
|
|
342
|
-
* @param
|
|
338
|
+
* @param commandFilePathUrl File path of the file with command to load
|
|
343
339
|
*/
|
|
344
|
-
async loadCommandFromFile(
|
|
345
|
-
|
|
346
|
-
|
|
340
|
+
async loadCommandFromFile(commandFileUrl) {
|
|
341
|
+
const commandsFolder = path.join(__dirname, '../m365');
|
|
342
|
+
const filePath = path.join(commandsFolder, commandFileUrl);
|
|
343
|
+
if (!fs.existsSync(filePath)) {
|
|
344
|
+
// reset command name
|
|
345
|
+
this.currentCommandName = undefined;
|
|
347
346
|
return;
|
|
348
347
|
}
|
|
349
348
|
try {
|
|
350
|
-
const
|
|
351
|
-
const command = await import(commandFileUrl);
|
|
349
|
+
const command = await import(pathToFileURL(filePath).toString());
|
|
352
350
|
if (command.default instanceof Command) {
|
|
353
|
-
this.
|
|
354
|
-
|
|
355
|
-
else {
|
|
356
|
-
await this.loadAllCommands();
|
|
351
|
+
const commandInfo = this.commands.find(c => c.file === commandFileUrl);
|
|
352
|
+
this.commandToExecute = Cli.getCommandInfo(command.default, commandFileUrl, commandInfo?.help);
|
|
357
353
|
}
|
|
358
354
|
}
|
|
359
|
-
catch {
|
|
360
|
-
await this.loadAllCommands();
|
|
361
|
-
}
|
|
355
|
+
catch { }
|
|
362
356
|
}
|
|
363
|
-
static getCommandInfo(command) {
|
|
357
|
+
static getCommandInfo(command, filePath = '', helpFilePath = '') {
|
|
364
358
|
return {
|
|
365
359
|
aliases: command.alias(),
|
|
366
360
|
name: command.name,
|
|
361
|
+
description: command.description,
|
|
367
362
|
command: command,
|
|
368
363
|
options: this.getCommandOptions(command),
|
|
369
|
-
defaultProperties: command.defaultProperties()
|
|
364
|
+
defaultProperties: command.defaultProperties(),
|
|
365
|
+
file: filePath,
|
|
366
|
+
help: helpFilePath
|
|
370
367
|
};
|
|
371
368
|
}
|
|
372
|
-
loadCommand(command) {
|
|
373
|
-
this.commands.push(Cli.getCommandInfo(command));
|
|
374
|
-
}
|
|
375
369
|
static getCommandOptions(command) {
|
|
376
370
|
const options = [];
|
|
377
371
|
command.options.forEach(option => {
|
|
@@ -568,58 +562,39 @@ export class Cli {
|
|
|
568
562
|
process.exit(exitCode);
|
|
569
563
|
}
|
|
570
564
|
printCommandHelp(helpMode) {
|
|
571
|
-
|
|
572
|
-
|
|
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);
|
|
565
|
+
const docsRootDir = path.join(__dirname, '..', '..', 'docs');
|
|
566
|
+
const helpFilePath = path.join(docsRootDir, 'docs', 'cmd', this.commandToExecute.help);
|
|
589
567
|
if (fs.existsSync(helpFilePath)) {
|
|
590
568
|
let helpContents = fs.readFileSync(helpFilePath, 'utf8');
|
|
591
569
|
helpContents = this.getHelpSection(helpMode, helpContents);
|
|
592
|
-
helpContents = md.md2plain(helpContents,
|
|
570
|
+
helpContents = md.md2plain(helpContents, docsRootDir);
|
|
593
571
|
Cli.log();
|
|
594
572
|
Cli.log(helpContents);
|
|
595
573
|
}
|
|
596
574
|
}
|
|
597
575
|
async getHelpMode(options) {
|
|
598
|
-
const h = options
|
|
599
|
-
|
|
576
|
+
const { h, help } = options;
|
|
577
|
+
if (!h && !help) {
|
|
578
|
+
return this.getSettingWithDefaultValue(settingsNames.helpMode, Cli.defaultHelpMode);
|
|
579
|
+
}
|
|
600
580
|
// user passed -h or --help, let's see if they passed a specific mode
|
|
601
581
|
// or requested the default
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
582
|
+
const helpMode = h ?? help;
|
|
583
|
+
if (typeof helpMode === 'boolean' || typeof helpMode !== 'string') {
|
|
584
|
+
// requested default mode or passed a number, let's use default
|
|
585
|
+
return this.getSettingWithDefaultValue(settingsNames.helpMode, Cli.defaultHelpMode);
|
|
586
|
+
}
|
|
587
|
+
else {
|
|
588
|
+
const lowerCaseHelpMode = helpMode.toLowerCase();
|
|
589
|
+
if (Cli.helpModes.indexOf(lowerCaseHelpMode) < 0) {
|
|
590
|
+
await Cli.getInstance().closeWithError(`Unknown help mode ${helpMode}. Allowed values are ${Cli.helpModes.join(', ')}`, { options }, false);
|
|
591
|
+
/* c8 ignore next 2 */
|
|
592
|
+
return ''; // noop
|
|
607
593
|
}
|
|
608
594
|
else {
|
|
609
|
-
|
|
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
|
-
}
|
|
595
|
+
return lowerCaseHelpMode;
|
|
618
596
|
}
|
|
619
597
|
}
|
|
620
|
-
else {
|
|
621
|
-
return this.getSettingWithDefaultValue(settingsNames.helpMode, Cli.defaultHelpMode);
|
|
622
|
-
}
|
|
623
598
|
}
|
|
624
599
|
getHelpSection(helpMode, helpContents) {
|
|
625
600
|
if (helpMode === 'full') {
|
|
@@ -709,7 +684,7 @@ export class Cli {
|
|
|
709
684
|
Cli.log();
|
|
710
685
|
const sortedCommandNamesToPrint = Object.getOwnPropertyNames(commandsToPrint).sort();
|
|
711
686
|
sortedCommandNamesToPrint.forEach(commandName => {
|
|
712
|
-
Cli.log(` ${`${commandName} [options]`.padEnd(maxLength, ' ')} ${commandsToPrint[commandName].
|
|
687
|
+
Cli.log(` ${`${commandName} [options]`.padEnd(maxLength, ' ')} ${commandsToPrint[commandName].description}`);
|
|
713
688
|
});
|
|
714
689
|
}
|
|
715
690
|
const namesOfCommandGroupsToPrint = Object.keys(commandGroupsToPrint);
|
|
@@ -804,35 +779,47 @@ export class Cli {
|
|
|
804
779
|
cli.spinner.start();
|
|
805
780
|
}
|
|
806
781
|
}
|
|
807
|
-
static async
|
|
782
|
+
static async promptForSelection(config) {
|
|
783
|
+
const cli = Cli.getInstance();
|
|
784
|
+
const spinnerSpinning = cli.spinner.isSpinning;
|
|
785
|
+
/* c8 ignore next 3 */
|
|
786
|
+
if (spinnerSpinning) {
|
|
787
|
+
cli.spinner.stop();
|
|
788
|
+
}
|
|
789
|
+
const answer = await prompt.forSelection(config);
|
|
790
|
+
Cli.error('');
|
|
791
|
+
// Restart the spinner if it was running before the prompt
|
|
792
|
+
/* c8 ignore next 3 */
|
|
793
|
+
if (spinnerSpinning) {
|
|
794
|
+
cli.spinner.start();
|
|
795
|
+
}
|
|
796
|
+
return answer;
|
|
797
|
+
}
|
|
798
|
+
static async promptForConfirmation(config) {
|
|
808
799
|
const cli = Cli.getInstance();
|
|
809
800
|
const spinnerSpinning = cli.spinner.isSpinning;
|
|
810
801
|
/* c8 ignore next 3 */
|
|
811
802
|
if (spinnerSpinning) {
|
|
812
803
|
cli.spinner.stop();
|
|
813
804
|
}
|
|
814
|
-
const
|
|
805
|
+
const answer = await prompt.forConfirmation(config);
|
|
806
|
+
Cli.error('');
|
|
815
807
|
// Restart the spinner if it was running before the prompt
|
|
816
808
|
/* c8 ignore next 3 */
|
|
817
809
|
if (spinnerSpinning) {
|
|
818
810
|
cli.spinner.start();
|
|
819
811
|
}
|
|
820
|
-
return
|
|
812
|
+
return answer;
|
|
821
813
|
}
|
|
822
814
|
static async handleMultipleResultsFound(message, values) {
|
|
823
815
|
const prompt = Cli.getInstance().getSettingWithDefaultValue(settingsNames.prompt, true);
|
|
824
816
|
if (!prompt) {
|
|
825
817
|
throw new Error(`${message} Found: ${Object.keys(values).join(', ')}.`);
|
|
826
818
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
prefix: '🌶️ ',
|
|
832
|
-
message: `${message} Please choose one:`,
|
|
833
|
-
choices: Object.keys(values)
|
|
834
|
-
});
|
|
835
|
-
return values[response.select];
|
|
819
|
+
Cli.error(`🌶️ ${message}`);
|
|
820
|
+
const choices = Object.keys(values).map((choice) => { return { name: choice, value: choice }; });
|
|
821
|
+
const response = await Cli.promptForSelection({ message: `Please choose one:`, choices });
|
|
822
|
+
return values[response];
|
|
836
823
|
}
|
|
837
824
|
static removeShortOptions(args) {
|
|
838
825
|
const filteredArgs = JSON.parse(JSON.stringify(args));
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import url from 'url';
|
|
5
2
|
import { Cli } from './cli/Cli.js';
|
|
6
3
|
import { telemetry } from './telemetry.js';
|
|
7
4
|
import { app } from './utils/app.js';
|
|
8
|
-
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
|
9
5
|
// required to make console.log() in combination with piped output synchronous
|
|
10
6
|
// on Windows/in PowerShell so that the output is not trimmed by calling
|
|
11
7
|
// process.exit() after executing the command, while the output is still
|
|
@@ -18,14 +14,12 @@ if (!process.env.CLIMICROSOFT365_NOUPDATE) {
|
|
|
18
14
|
updateNotifier.default({ pkg: app.packageJson() }).notify({ defer: false });
|
|
19
15
|
});
|
|
20
16
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
});
|
|
17
|
+
try {
|
|
18
|
+
const cli = Cli.getInstance();
|
|
19
|
+
cli.execute(process.argv.slice(2));
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
telemetry.trackException(e);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
31
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -24,7 +24,7 @@ class AadAdministrativeUnitAddCommand extends GraphCommand {
|
|
|
24
24
|
const requestOptions = {
|
|
25
25
|
url: `${this.resource}/v1.0/directory/administrativeUnits`,
|
|
26
26
|
headers: {
|
|
27
|
-
|
|
27
|
+
accept: 'application/json;odata.metadata=none'
|
|
28
28
|
},
|
|
29
29
|
responseType: 'json',
|
|
30
30
|
data: {
|
|
@@ -45,7 +45,7 @@ class AadAdministrativeUnitAddCommand extends GraphCommand {
|
|
|
45
45
|
_AadAdministrativeUnitAddCommand_instances = new WeakSet(), _AadAdministrativeUnitAddCommand_initTelemetry = function _AadAdministrativeUnitAddCommand_initTelemetry() {
|
|
46
46
|
this.telemetry.push((args) => {
|
|
47
47
|
Object.assign(this.telemetryProperties, {
|
|
48
|
-
hiddenMembership: args.options.hiddenMembership
|
|
48
|
+
hiddenMembership: !!args.options.hiddenMembership
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
51
|
}, _AadAdministrativeUnitAddCommand_initOptions = function _AadAdministrativeUnitAddCommand_initOptions() {
|
|
@@ -54,7 +54,7 @@ _AadAdministrativeUnitAddCommand_instances = new WeakSet(), _AadAdministrativeUn
|
|
|
54
54
|
}, {
|
|
55
55
|
option: '-d, --description [description]'
|
|
56
56
|
}, {
|
|
57
|
-
option: '--hiddenMembership
|
|
57
|
+
option: '--hiddenMembership'
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
60
|
export default new AadAdministrativeUnitAddCommand();
|