From 671a15f65f4f170d2672a6d32faad4c3ccb14b97 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 2 Jul 2024 10:38:54 +0100 Subject: [PATCH] fs: add Groups and FieldName to Option --- fs/fs_test.go | 1 + fs/registry.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/fs/fs_test.go b/fs/fs_test.go index a83137072..15e78853d 100644 --- a/fs/fs_test.go +++ b/fs/fs_test.go @@ -232,6 +232,7 @@ func TestOptionMarshalJSON(t *testing.T) { assert.NoError(t, err) require.Equal(t, `{ "Name": "case_insensitive", +"FieldName": "", "Help": "", "Provider": "", "Default": false, diff --git a/fs/registry.go b/fs/registry.go index 71a0b5a6c..50fb92714 100644 --- a/fs/registry.go +++ b/fs/registry.go @@ -149,6 +149,8 @@ const ( // // This also describes command line options and environment variables. // +// It is also used to describe options for the API. +// // To create a multiple-choice option, specify the possible values // in the Examples property. Whether the option's value is required // to be one of these depends on other properties: @@ -159,7 +161,9 @@ const ( // and do not set Default. type Option struct { Name string // name of the option in snake_case + FieldName string // name of the field used in the rc JSON - will be auto filled normally Help string // help, start with a single sentence on a single line that will be extracted for command line help + Groups string `json:",omitempty"` // groups this option belongs to - comma separated string for options classification Provider string // set to filter on provider Default interface{} // default value, nil => "", if set (and not to nil or "") then Required does nothing Value interface{} // value to be set by flags