Closed alan-morey closed 1 month ago
Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.
Hey @alan-morey - this is interesting. I'm thinking that this is the same code that's used to build --help
output, where the default username would be useful to know during an active CLI session. But also because you're running yarn oclif readme
in a directory where you have a local target-org
config set which requires the directory to be a valid salesforce project.
Are you setting that config globally?
I'm sure that use case didn't cross our minds while building this, but I'm also not sure that it's a bug. Setting the SF_TARGET_ORG
env var before running the script is a great workaround like you mentioned, and could be hardcoded in your package.json
@WillieRuemmele Yes, I have a global config option set for my target-org
and I use local level option too.
sf config set --global target-org=mydefaultorg
My saleforce project has a sub folder cli-plugin
, so that's why my local sf config options get resolved when I'm working within my cli-plugin but even when I clear the local config option, the global option will be used. So I would need to clear that too.
The resolved usernames for defaults in help totally makes sense during active CLI sessions and I think this is a great feature.
Setting SF_TARGET_ORG
works fine for now as workaround, I'll probably add this to package.json
anyway but that's just one resolved default value. I can see this being an issue if I have to provide overrides for many different values.
Is there any option or Environment variable to tell sf
not to read my config files? Or can I configure it to read a different config path, for example SF_CONFIG_PATH=/dev/null
?
Also, if SF_TARGET_ORG
overrides config options set with sf config set
, should generated help take that into consideration when resolving the default value for related flag? Currently it appears that setting SF_TARGET_ORG
to any value means the username resolution does nothing in the help but when it's undefined the username is resolved from config option.
@alan-morey - are you using Flags.requiredOrg()
from @salesforce/sf-plugins-core
? those flags have noCacheDefault: false
so that this information shouldn't be displayed. If you are, can you verify you're on v11 of sf-plugins-core
where that default has been set
This issue has been linked to a new work item: W-16883857
@WillieRuemmele The generated plugin had sf-plugins-core
at v10. I upgraded to latest (v11.3.10) and same issue
We'll get this fixed soon
This issue has been fixed in CLI version 2.62.6 (October 16, 2024).
Summary
Given I have a configuration set for
target-org
, e.g.sf config set target-org=user@example.com.myorg
, when I useyarn oclif readme
to generate theREADME.md
content for my CLI plugin, theREADME.md
contains my configuredtarget-org
"user@example.com.myorg" as the default value for thetarget-org
flag of my command but I do not want my personal configurations to be used as default values inREADME.md
.Steps To Reproduce
target-org
config valuesrc/commands/hello/world.ts
and add a new flag:-o, --target-org
Expected result
Expected that generated flag description would look some like the following:
I was expecting the README would be generated in a generic way, not referencing my configuration values and using those to populate the defaults for flags.
Actual result
README generated by
oclif readme
contains flag defaults resolved from my sf config values.Additional information
To workaround this I have been clearing my
target-org
configurations, both local and global, generating the README, then re-setup my config values.This is annoying and cumbersome.
Another alternative, is to set
SF_TARGET_ORG
to some value while runningoclif readme
This workaround is more convenient as I don't have to remember to set up my config options again.
System Information