-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: default to current working directory when no plugins are provided #15
Conversation
}), | ||
hidden: flags.boolean({ description: messages.getMessage('hiddenFlagDescription') }), | ||
erroronwarnings: flags.boolean({ description: messages.getMessage('erroronwarningFlagDescription') }) | ||
}; | ||
|
||
public async run(): Promise<AnyJson> { | ||
const plugins = this.flags.plugins | ||
let pluginNames: string[]; | ||
if (!this.flags.plugins) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some error messaging? For example, I can do sfdx plugins:install command-reference
then sfdx commandreference:generate
in any directory I want.
if (!this.flags.plugins) { | ||
const pJsonPath = path.join(process.cwd(), 'package.json'); | ||
const packageJson = await fs.readJson(pJsonPath); | ||
pluginNames = [getString(packageJson, 'name')]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we log to the user what plugin we are going to generate reference for?
messages/main.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"commandDescription": "generate the command reference guide located", | |||
"pluginFlagDescription": "comma separated list of plugin names to be part of the generation", | |||
"pluginFlagDescription": "comma separated list of plugin names to be part of the generation. Defaults to current working directory.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe. - defaults to the plugin in the current working directory, if there is one
? See my note below.
pluginNames = [getString(packageJson, 'name')]; | ||
} else { | ||
throw new SfdxError( | ||
'No package.json found in current working directory. Please cd into a directory that contains a valid oclif plugin' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No plugins provided. Provide the '--plugins' flag or cd into a directory that contains a valid oclif plugin.
messages/main.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"commandDescription": "generate the command reference guide located", | |||
"pluginFlagDescription": "comma separated list of plugin names to be part of the generation", | |||
"pluginFlagDescription": "comma separated list of plugin names to be part of the generation. Defaults to the current working directory if it's a valid oclif plugin.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still sounds weird to me because this is a plugin list, and you are saying it defaults to the current working directory which is a file path, not a plugin. Maybe defaults to the oclif plugin in the current working directory
# [1.3.0](v1.2.6...v1.3.0) (2021-02-02) ### Features * default to current working directory when no plugins are provided ([#15](#15)) ([57a66b2](57a66b2))
🎉 This PR is included in version 1.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Defaults to the plugin in the current working directory if no plugins are provided with the -p flag