aconfig
aconfig copied to clipboard
Does aconfig support short and long versions of fields?
I'm trying to find out if it's possible that aconfig is able to parse a field that has 2 different uses, a short version (string) and a long version (struct) which provides more detailed version of the overall use.
For example
dependencies:
- name: example-plugin
url: github://someuser/somerepo
branch: master
release: v1.0.0
- name: plugin-repo-without-package-file
url: gitlab://someuser/somerepo
branch: dev
release:
name: my_plugin_{{.OS}}
tag: v2.1.3
type: archive
path: plugin/plugin
Would I be able to do this, where I can parse it as an interface and then handle extracting it based on it's type?
Hi, there is no direct support for this. You can try to make it via interface{}
as you've mentioned but no idea how it will be :)
Ah okay, I have tried to give this ago, and unfortunately it errors out and doesn't like trying to parse an interface. Would there ever be support for this in the future?
Cannot say for sure. At first it looks like this feature is against current design (everything must be defined in a clear and 1 possible way), from the other side I'm somewhat open for the proposals.
I'm scared that this feature solves small problem and time/pr/review/support will be much higher.
Probably it's easier to change the config to tag
and release
for this example and forget about minimisation of the config, wdyt? :)
Okay, yeah I will give that a go and see how it goes. I was just trying to be convivence for my users. Thanks for responding.