Skip to content

Bug report: CLI Config prompt not working when given false as the value #4020

@arjunumenon

Description

@arjunumenon

Description

Config settings for prompt not working when false is given as value.

  • Execute command m365 cli config set --key prompt --value false
  • Run any command which prompts for fields, say m365 spo set
  • We will still get prompt eventhough configured value is false

Steps to reproduce

  • Execute command m365 cli config set --key prompt --value false
  • Run any command which prompts for fields, say m365 spo set
  • We will still get prompt eventhough configured value is false

image

Expected results

Prompt should not be active if the prompt settings is false

Actual results

We will still get prompt eventhough configured value is false

image

Diagnostics

N/A

CLI for Microsoft 365 version

5.9.0

nodejs version

14.16.0

Operating system (environment)

Windows

Shell

Windows PowerShell

cli doctor

C:\Arjun\Codes ❯ m365 cli doctor
{
  "os": {
    "platform": "win32",
    "version": "Windows 10 Pro",
    "release": "10.0.22000"
  },
  "cliVersion": "5.9.0",
  "nodeVersion": "v14.16.0",
  "cliAadAppId": "31359c7f-bd7e-475c-86db-fdb8c937548e",
  "cliAadAppTenant": "common",
  "authMode": "DeviceCode",
  "cliEnvironment": "",
  "cliConfig": {
    "prompt": "false"
  },
  "roles": [],
  "scopes": [
    "AllSites.FullControl",
    "AppCatalog.ReadWrite.All",
    "AuditLog.Read.All",
    "ChannelMember.ReadWrite.All",
    "ChannelMessage.Read.All",
    "ChannelMessage.Send",
    "ChannelSettings.ReadWrite.All",
    "Chat.Read",
    "Chat.ReadWrite",
    "Directory.AccessAsUser.All",
    "Directory.ReadWrite.All",
    "Group.ReadWrite.All",
    "IdentityProvider.ReadWrite.All",
    "Mail.ReadWrite",
    "Mail.Send",
    "Place.Read.All",
    "Policy.Read.All",
    "Reports.Read.All",
    "SecurityEvents.Read.All",
    "ServiceHealth.Read.All",
    "ServiceMessage.Read.All",
    "ServiceMessageViewpoint.Write",
    "Tasks.ReadWrite",
    "Team.Create",
    "TeamMember.ReadWrite.All",
    "TeamsApp.ReadWrite.All",
    "TeamsAppInstallation.ReadWriteForUser",
    "TeamSettings.ReadWrite.All",
    "TeamsTab.ReadWrite.All",
    "TermStore.ReadWrite.All",
    "User.Invite.All",
    "User.ReadWrite.All",
    "profile",
    "openid",
    "email"
  ]
}

Additional Info

A bit of troubleshooting concluded that the settings prompt value was kept as a string rather than a boolean which might be causing the issue.

image

We can see that value is not set as boolean rather as a text since the value prompt was not given in the switch case here -

switch (args.options.key) {
case settingsNames.autoOpenLinksInBrowser:
case settingsNames.copyDeviceCodeToClipboard:
case settingsNames.csvHeader:
case settingsNames.csvQuoted:
case settingsNames.csvQuotedEmpty:
case settingsNames.printErrorsAsPlainText:
case settingsNames.showHelpOnFailure:
value = args.options.value === 'true';
break;
default:
value = args.options.value;
break;
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions