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

Integrate with urfave/cli/v3 APIs #6

Merged
merged 10 commits into from
Jun 23, 2023
Merged

Integrate with urfave/cli/v3 APIs #6

merged 10 commits into from
Jun 23, 2023

Conversation

meatballhat
Copy link
Member

@meatballhat meatballhat commented Jun 23, 2023

This is essentially a library replacement, given that none of the InputSourceContext and flag type wrappers were working without modification and the more recent ValueSource API in urfave/cli/v3 allows for a much simpler (imho) integration.

Closes #5

@meatballhat meatballhat requested a review from a team June 23, 2023 02:19
altsrc.go Outdated Show resolved Hide resolved
altsrc.go Outdated Show resolved Hide resolved
altsrc.go Outdated Show resolved Hide resolved
altsrc.go Outdated Show resolved Hide resolved
return nil
}

func ExampleYAML() {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can collapse the code in these 3 examples with a

setupApp(ValueSources..) convenience method.

That way all the examples have to do is pass in the value sources and rest remains the same.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was hesitant to abstract too much of it because the bodies of these will appear in godoc documentation but without the setup code or abstracted/shared code 🤔

}

func unmarshalMap(i any) (ret map[any]any, err error) {
ret = make(map[any]any)
Copy link
Contributor

Choose a reason for hiding this comment

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

map[string]any ?

Copy link
Member Author

Choose a reason for hiding this comment

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

idk; this was a move too 🤔 I was thinking I'd avoid changing the implementation at this time but I can!

file_source_cache.go Outdated Show resolved Hide resolved
@dearchap
Copy link
Contributor

@meatballhat That was some nice piece of works. Thanks

@meatballhat meatballhat merged commit 26109e3 into main Jun 23, 2023
9 checks passed
@meatballhat meatballhat deleted the cli-v3-integration branch June 23, 2023 21:36
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.

Fulfill ValueSource interface for urfave/cli/v3 integration
2 participants