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

CLI: simplify and clarify usage text #7277

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

shykes
Copy link
Contributor

@shykes shykes commented May 3, 2024

No description provided.

@grouville
Copy link
Member

grouville commented May 4, 2024

cmd/dagger/functions.go Outdated Show resolved Hide resolved
cmd/dagger/call.go Show resolved Hide resolved
cmd/dagger/call.go Outdated Show resolved Hide resolved
@helderco
Copy link
Contributor

helderco commented May 6, 2024

@shykes, I rebased. Only not merging because waiting for reply to #7277 (comment).

@gerhard
Copy link
Member

gerhard commented May 7, 2024

@helderco you may want to rebase this again.

These are the most important change that this PR has not picked up yet:

@shykes
Copy link
Contributor Author

shykes commented May 7, 2024

@shykes, I rebased. Only not merging because waiting for reply to #7277 (comment).

Thanks, sorry I had missed your rebase earlier.

Signed-off-by: Solomon Hykes <solomon@dagger.io>
by appending it to the end of the command (for example, ´stdout´, ´entries´, or
´contents´).
`,
Name: "call [options] [FUNCTION [FUNCTION...]]",
Copy link
Contributor

@helderco helderco May 17, 2024

Choose a reason for hiding this comment

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

[arguments] and <function> are appended to the usage line dynamically based on the existence of arguments or further functions, respectively. So this will produce the following:

dagger call [options] [FUNCTION [FUNCTION...]] [arguments] <function>

[options] only show on call (doesn't include global flags), so leaving as is creates this usage while you keep adding functions (assuming there's constructor arguments):

dagger call [options] [arguments] <function>
dagger call cli <function>
dagger call cli file [arguments] <function>
dagger call cli file name

Notice also that we conventionalized usage syntax here:

`,
Name: "call [options] [FUNCTION [FUNCTION...]]",
Short: "Call a function, or a pipeline of functions",
Long: strings.ReplaceAll(`Call a function, or a pipeline of functions, and print the result`,
Copy link
Contributor

Choose a reason for hiding this comment

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

The strings.ReplaceAll here is no longer needed. It was a clever hack to allow markdown with ´--output´ for example.

@@ -55,6 +41,7 @@ dagger call lint stdout
case Terminal:
c.Select("websocketEndpoint")
default:
// FIXME: don't make this an error, it's confusing to users
Copy link
Contributor

@helderco helderco May 17, 2024

Choose a reason for hiding this comment

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

This error has been replaced with:

Basically any chain that ends in an object that has itself functions, lists them under "Available Functions".

@shykes
Copy link
Contributor Author

shykes commented May 18, 2024

This was meant to be a quick win... Does it even make sense for me to update this, with other improvements in flight?

@helderco
Copy link
Contributor

This was meant to be a quick win... Does it even make sense for me to update this, with other improvements in flight?

I think so. Let’s see:

Since we'll want to conventionalize on export --path PATH rather than -o PATH, I think it's ok to clear the whole Long description now so people don't get used to it. The value "Call a function, or a pipeline of functions, and print the result" is short enough to be in Short, without having Long too.

The update on the --output flag's description is an improvement too.

As for the examples, they're hardly helpful as they are. It would be more helpful to have a stable URL to add to the end of --help to learn more, but I say remove the examples now, and add that URL in a follow up when it’s available.

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

Successfully merging this pull request may close these issues.

None yet

4 participants