@@ -20,7 +20,6 @@ import (
20
20
"fmt"
21
21
"io"
22
22
"path/filepath"
23
- "strconv"
24
23
"strings"
25
24
26
25
"github.com/arduino/arduino-cli/arduino/cores"
@@ -67,13 +66,8 @@ func SupportedUserFields(ctx context.Context, req *rpc.SupportedUserFieldsReques
67
66
return nil , err
68
67
}
69
68
70
- userFields , err := getUserFields (toolID , platformRelease )
71
- if err != nil {
72
- return nil , err
73
- }
74
-
75
69
return & rpc.SupportedUserFieldsResponse {
76
- UserFields : userFields ,
70
+ UserFields : getUserFields ( toolID , platformRelease ) ,
77
71
}, nil
78
72
}
79
73
@@ -95,7 +89,7 @@ func getToolID(props *properties.Map, action, protocol string) (string, error) {
95
89
96
90
// getUserFields return all user fields supported by the tools specified.
97
91
// 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 {
99
93
userFields := []* rpc.UserField {}
100
94
fields := platformRelease .Properties .SubTree (fmt .Sprintf ("tools.%s.upload.field" , toolID ))
101
95
keys := fields .FirstLevelKeys ()
@@ -105,15 +99,7 @@ func getUserFields(toolID string, platformRelease *cores.PlatformRelease) ([]*rp
105
99
if len (value ) > 50 {
106
100
value = fmt .Sprintf ("%s…" , value [:49 ])
107
101
}
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 ))
117
103
userFields = append (userFields , & rpc.UserField {
118
104
ToolId : toolID ,
119
105
Name : key ,
@@ -122,7 +108,7 @@ func getUserFields(toolID string, platformRelease *cores.PlatformRelease) ([]*rp
122
108
})
123
109
}
124
110
125
- return userFields , nil
111
+ return userFields
126
112
}
127
113
128
114
// Upload FIXMEDOC
0 commit comments