@@ -20,7 +20,6 @@ import (
2020 "fmt"
2121 "io"
2222 "path/filepath"
23- "strconv"
2423 "strings"
2524
2625 "github.com/arduino/arduino-cli/arduino/cores"
@@ -67,13 +66,8 @@ func SupportedUserFields(ctx context.Context, req *rpc.SupportedUserFieldsReques
6766 return nil , err
6867 }
6968
70- userFields , err := getUserFields (toolID , platformRelease )
71- if err != nil {
72- return nil , err
73- }
74-
7569 return & rpc.SupportedUserFieldsResponse {
76- UserFields : userFields ,
70+ UserFields : getUserFields ( toolID , platformRelease ) ,
7771 }, nil
7872}
7973
@@ -95,7 +89,7 @@ func getToolID(props *properties.Map, action, protocol string) (string, error) {
9589
9690// getUserFields return all user fields supported by the tools specified.
9791// Returns error only in case the secret property is not a valid boolean.
98- func getUserFields (toolID string , platformRelease * cores.PlatformRelease ) ( []* rpc.UserField , error ) {
92+ func getUserFields (toolID string , platformRelease * cores.PlatformRelease ) []* rpc.UserField {
9993 userFields := []* rpc.UserField {}
10094 fields := platformRelease .Properties .SubTree (fmt .Sprintf ("tools.%s.upload.field" , toolID ))
10195 keys := fields .FirstLevelKeys ()
@@ -105,15 +99,7 @@ func getUserFields(toolID string, platformRelease *cores.PlatformRelease) ([]*rp
10599 if len (value ) > 50 {
106100 value = fmt .Sprintf ("%s…" , value [:49 ])
107101 }
108- secretProp := fmt .Sprintf ("%s.secret" , key )
109- secret , ok := fields .GetOk (secretProp )
110- if ! ok {
111- secret = "false"
112- }
113- isSecret , err := strconv .ParseBool (secret )
114- if err != nil {
115- return nil , fmt .Errorf (tr ("parsing %s, property is not a boolean" ), fmt .Sprintf (`"tools.%s.upload.field.%s.secret"` , toolID , key ))
116- }
102+ isSecret := fields .GetBoolean (fmt .Sprintf ("%s.secret" , key ))
117103 userFields = append (userFields , & rpc.UserField {
118104 ToolId : toolID ,
119105 Name : key ,
@@ -122,7 +108,7 @@ func getUserFields(toolID string, platformRelease *cores.PlatformRelease) ([]*rp
122108 })
123109 }
124110
125- return userFields , nil
111+ return userFields
126112}
127113
128114// Upload FIXMEDOC
0 commit comments