Skip to content

cli: list available functions when chain ends in an object - #7421

Closed
helderco wants to merge 4 commits into
dagger:mainfrom
helderco:helder/oss-73-cli-print-module-object-fields-with-dagger-call
Closed

helderco wants to merge 4 commits into
dagger:mainfrom
helderco:helder/oss-73-cli-print-module-object-fields-with-dagger-call

Conversation

@helderco

@helderco helderco commented May 20, 2024 •

Copy link
Copy Markdown
Contributor

Fixes #6515

This allows for a much nicer feedback loop while you navigate the command tree. It also makes dagger function redundant.1

Before

❯ dagger call cli file
File evaluated. Use "dagger call cli file --help" to see available sub-commands.

Waited a long time while the File was evaluated, to end in a usage message.

After

Fast response because no query is executed (and more informative):

❯ dagger call cli file
AVAILABLE FUNCTIONS
  contents          Retrieves the contents of the file.
  export            Writes the file to a file path on the host.
  name              Retrieves the name of the file.
  size              Retrieves the size of the file, in bytes.
  sync              Force evaluation in the engine.
  with-timestamps   Retrieves this file with its created/modified timestamps set to the given time.

Use 'dagger call cli file <function> --help' for more information about a function.

Note

This removes sync as a default selection for commands ending in a Container, Directory or File. \cc @vikram-dagger for impact on docs.

Footnotes

  1. If we deprecate dagger function it also solves an issue with chains that end in a leaf, which return an error that there are no more functions available. With dagger call it just executes it. ↩

@helderco
helderco force-pushed the helder/oss-73-cli-print-module-object-fields-with-dagger-call branch from abcf849 to a543079 Compare May 21, 2024 12:24
@helderco
helderco requested a review from jedevc May 21, 2024 13:02
helderco added 4 commits May 24, 2024 15:40
This removes `sync` as a default selection for commands ending in a `Container`, `Directory` or `File`.

Signed-off-by: Helder Correia <[email protected]>
Signed-off-by: Helder Correia <[email protected]>
Signed-off-by: Helder Correia <[email protected]>
Signed-off-by: Helder Correia <[email protected]>
@helderco
helderco force-pushed the helder/oss-73-cli-print-module-object-fields-with-dagger-call branch from 0bee1bc to bebf363 Compare May 24, 2024 15:41
@shykes

shykes commented May 24, 2024

Copy link
Copy Markdown
Contributor

Sorry but I still prefer the other option discussed in #6515: actually printing the contents. I understand the desire for a better discovery flow, --help is not ideal. But when I type dagger call FUNC, I expect FUNC to be... called.

I like the feature in this PR but think it needs another home than dagger call.

@helderco

Copy link
Copy Markdown
Contributor Author

I like the feature in this PR but think it needs another home than dagger call.

I'm thinking that the changes here could be moved to dagger functions. That would put that command on equal grounds to dagger call (in terms of implementation) rather than having its own logic and escape hatches within the common FuncCommand logic.

@helderco

Copy link
Copy Markdown
Contributor Author

Closing this in favor of:

@helderco helderco closed this May 28, 2024
@helderco
helderco deleted the helder/oss-73-cli-print-module-object-fields-with-dagger-call branch May 29, 2024 10:34
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.

CLI: print module object fields with dagger call

2 participants