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

Ned's very WIP proposal for the API #1

Merged
merged 24 commits into from
Jun 30, 2021
Merged

Ned's very WIP proposal for the API #1

merged 24 commits into from
Jun 30, 2021

Conversation

na--
Copy link
Member

@na-- na-- commented Jun 25, 2021

This is very, very far from final, but it's an expansion on the ad-hoc proposal I sent in Slack, together with the rough requirements in and a basic TODO proposal the README.

@na-- na-- requested review from artych and codebien June 25, 2021 06:49
sourceGetter, err := callback(i)
if err == nil {
f.source = sourceGetter.GetSource()
if f.source != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is f.source is the latest source intentionally? May be to call it f.latestSource then?

Copy link
Member Author

@na-- na-- Jun 29, 2021

Choose a reason for hiding this comment

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

Hmm true, but I'm not sure which is clearer though 😕 My thinking was that this is the source that actually produced the value at dest after the consolidation. While latestSource also means the same think, it can also be confused with the top-level source (e.g. CLI flags), since it was tried last, even when it didn't return an actual value.

na-- added 6 commits June 29, 2021 06:34
This will allow us to have CLI flags, I think...
This is temporarily done via the pflag library, though it's a very poor fit for our use case
Since we're "driving" the parsing in manual, we get the quotes and have to strip them
This is a prototype of how we can have a completely custom field with type-safe defaults and JSON unmarshalling, at the cost of referencing the destination multiple times...
@na-- na-- marked this pull request as ready for review June 30, 2021 15:26
@na-- na-- merged commit 8d694b8 into main Jun 30, 2021
@na-- na-- deleted the ned-wip branch June 30, 2021 15:48
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

2 participants