Skip to content
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

Merged
merged 3 commits into from
Feb 2, 2021

Conversation

mdonnalley
Copy link
Contributor

Defaults to the plugin in the current working directory if no plugins are provided with the -p flag

@mdonnalley mdonnalley self-assigned this Feb 2, 2021
@mdonnalley mdonnalley requested a review from amphro February 2, 2021 01:25
}),
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) {
Copy link
Contributor

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')];
Copy link
Contributor

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?

@@ -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.",
Copy link
Contributor

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.

@mdonnalley mdonnalley requested a review from amphro February 2, 2021 19:45
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'
Copy link
Contributor

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.

@@ -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.",
Copy link
Contributor

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

@mdonnalley mdonnalley requested a review from amphro February 2, 2021 19:51
@mdonnalley mdonnalley merged commit 57a66b2 into master Feb 2, 2021
@mdonnalley mdonnalley deleted the mdonnalley/default-to-cwd branch February 2, 2021 19:55
github-actions bot pushed a commit that referenced this pull request Feb 2, 2021
# [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))
@github-actions
Copy link

github-actions bot commented Feb 2, 2021

🎉 This PR is included in version 1.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants