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

Implement the --help command #5409

Merged
merged 4 commits into from
Jun 24, 2024
Merged

Implement the --help command #5409

merged 4 commits into from
Jun 24, 2024

Conversation

zoeyTM
Copy link
Contributor

@zoeyTM zoeyTM commented Jun 19, 2024

resolves #5348

Global:
Screen Shot 2024-06-19 at 6 21 18 AM

Per task:
Screen Shot 2024-06-19 at 6 21 49 AM

Per empty task:
Screen Shot 2024-06-19 at 6 22 05 AM

Copy link

changeset-bot bot commented Jun 19, 2024

⚠️ No Changeset found

Latest commit: bb8dfe3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jun 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2024 4:33am

@alcuadrado alcuadrado added v-next A Hardhat v3 development task and removed status:triaging labels Jun 19, 2024

const exampleTaskOverride = overrideTask("example")
.setAction(async (args, _hre, runSuper) => {
import type { HardhatUserConfig } from "./src/config.js";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note, this config to play around with v3 can now be done in example-project.

import type { ParameterType } from "@nomicfoundation/hardhat-core/config";
import type { Task } from "@nomicfoundation/hardhat-core/types/tasks";

export const GLOBAL_OPTIONS = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: I think we can handle this and reserved words differently so that they are more unified with the rest of the global options.

For a follow up pr though

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created an issue for this

Comment on lines +88 to +97
.map((letter, idx) => {
return letter.toUpperCase() === letter
? `${idx !== 0 ? "-" : ""}${letter.toLowerCase()}`
: letter;
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schaable do we have a utility for this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have the opposite (kebabToCamel). We should add this.

let output = `Usage: hardhat [GLOBAL OPTIONS] ${task.id.join(" ")}`;

if (options.length > 0) {
output += ` ${options.map((o) => `[${o.name}${o.type === "BOOLEAN" ? "" : ` <${o.type}>`}]`).join(" ")}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Options and positional arguments can be optional if they have a default value. In that case, they need to be wrapped around "[]`, otherwise they don't.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, these options may all be, well... optional

#5419

Copy link
Member

@alcuadrado alcuadrado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just left a small comment about [ ] for optional params. The rest looks good to me.

@zoeyTM zoeyTM merged commit 733fa6a into v-next Jun 24, 2024
41 of 45 checks passed
@zoeyTM zoeyTM deleted the feat/help-option branch June 24, 2024 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v-next A Hardhat v3 development task
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Implement and test a module that prints the different help messages (global, per task, subtasks)
4 participants