Skip to content

Commit 05bda68

Browse files
committed
Improve struct comments
1 parent c336644 commit 05bda68

File tree

8 files changed

+20
-39
lines changed

8 files changed

+20
-39
lines changed

command/config/init.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@ import (
1111
)
1212

1313
// InitParams contains the parameters needed to initialize a configuration file.
14-
// DestDir - destination directory in which the configuration file will be saved.
15-
// Overwrite - specify if existing config file should be overwritten.
16-
// Format - the config file format, can be 'json' or 'yaml'.
1714
type InitParams struct {
18-
DestDir string
19-
Overwrite bool
20-
Format string
15+
DestDir string // Destination directory in which the configuration file will be saved
16+
Overwrite bool // Overwrite specifies if existing config file should be overwritten
17+
Format string // Config file format, can be 'json' or 'yaml'
2118
}
2219

2320
func validateFormatString(arg string) error {

command/device/create.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,10 @@ import (
1414

1515
// CreateParams contains the parameters needed
1616
// to find the device to be provisioned.
17-
// Name - mandatory parameter.
18-
// Port - optional parameter. If omitted then each serial port is analyzed.
19-
// Fqbn - optional parameter. If omitted then the first device found gets selected.
2017
type CreateParams struct {
21-
Name string
22-
Port *string
23-
Fqbn *string
18+
Name string // Device name
19+
Port *string // Serial port - Optional - If omitted then each serial port is analyzed
20+
Fqbn *string // Board FQBN - Optional - If omitted then the first device found gets selected
2421
}
2522

2623
type board struct {

command/thing/bind.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ import (
88

99
// BindParams contains the parameters needed to
1010
// bind a thing to a device.
11-
// ID indicates the thing to bind.
12-
// deviceID indicates the device bind.
1311
type BindParams struct {
14-
ID string
15-
DeviceID string
12+
ID string // ID of the thing to be bound
13+
DeviceID string // ID of the device to be bound
1614
}
1715

1816
// Bind command is used to bind a thing to a device

command/thing/clone.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ import (
1010

1111
// CloneParams contains the parameters needed to clone a thing.
1212
type CloneParams struct {
13-
// Mandatory - contains the name of the thing
14-
Name string
15-
// Mandatory - specifies ID of thing to be cloned
16-
CloneID string
13+
Name string // Name of the new thing
14+
CloneID string // ID of thing to be cloned
1715
}
1816

1917
// Clone allows to create a new thing from an already existing one

command/thing/create.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ import (
1515

1616
// CreateParams contains the parameters needed to create a new thing.
1717
type CreateParams struct {
18-
// Optional - contains the name of the thing
19-
Name *string
20-
// Mandatory - contains the path of the template file
21-
Template string
18+
Name *string // Name of the new thing
19+
Template string // Path of the template file
2220
}
2321

2422
// Create allows to create a new thing

command/thing/extract.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ import (
1515
)
1616

1717
// ExtractParams contains the parameters needed to
18-
// extract a thing from Arduino IoT Cloud and save it on local storage.
19-
// Format determines the file format of the template ("json" or "yaml")
20-
// Output indicates the destination path of the extraction.
18+
// extract a template thing from Arduino IoT Cloud and save it on local storage.
2119
type ExtractParams struct {
2220
ID string
23-
Format string
24-
Outfile *string
21+
Format string // Format determines the file format of the template ("json" or "yaml")
22+
Outfile *string // Destination path of the extracted template
2523
}
2624

2725
// Extract command is used to extract a thing template

command/thing/list.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@ import (
77

88
// ListParams contains the optional parameters needed
99
// to filter the things to be listed.
10-
// If IDs is valid, only things belonging to that list are listed.
11-
// If DeviceID is provided, only things associated to that device are listed.
12-
// If Variables is true, variables names are retrieved.
1310
type ListParams struct {
14-
IDs []string
15-
DeviceID *string
16-
Variables bool
11+
IDs []string // If IDs is not nil, only things belonging to that list are returned
12+
DeviceID *string // If DeviceID is provided, only the thing associated to that device is listed.
13+
Variables bool // If Variables is true, variable names are retrieved.
1714
}
1815

1916
// List command is used to list

internal/config/config.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ import (
99
// Config contains all the configuration parameters
1010
// known by iot-cloud-cli
1111
type Config struct {
12-
// Client ID of the user
13-
Client string `map-structure:"client"`
14-
// Secret ID of the user, unique for each Client ID
15-
Secret string `map-structure:"secret"`
12+
Client string `map-structure:"client"` // Client ID of the user
13+
Secret string `map-structure:"secret"` // Secret ID of the user, unique for each Client ID
1614
}
1715

1816
// Retrieve returns the actual parameters contained in the

0 commit comments

Comments
 (0)