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: custom flag parser for Platform args #6739

Closed
wants to merge 1 commit into from

Conversation

jedevc
Copy link
Member

@jedevc jedevc commented Feb 26, 2024

This is tricky, since the scalar aliases were getting lost in our TypeDef code. We can preserve these, and then provide a custom parser.

With this, we can add validation that the target platform is valid, as well as allow a special current platform, which allows this use case:

package main

import (
	"fmt"
)

type Playground struct{}

func (m *Playground) Hello(platform Platform) string {
	return fmt.Sprintf("hello i am platform %q", platform)
}
❯ dagger call hello --platform=current
hello i am platform "linux/amd64"

… platform flag

Signed-off-by: Justin Chadwell <me@jedevc.com>
@helderco
Copy link
Contributor

I'd rather have a proper ScalarKind (and EnumKind) for core translation. See DEV-3403.

@jedevc
Copy link
Member Author

jedevc commented Feb 26, 2024

@helderco 100% agree, this was just a WIP to see if the idea worked 🎉

Next step is a proper ScalarKind!

Copy link
Contributor

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.

Copy link
Contributor

This PR was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this Mar 19, 2024
@jedevc jedevc mentioned this pull request Apr 22, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants