Skip to content

Commit 2b3af02

Browse files
committed
device: create-standalone: add --device-slug option
1 parent 2b0de71 commit 2b3af02

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

internal/app/enaptercli/cmd_device_create_standalone.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type cmdDeviceCreateStandalone struct {
1414
cmdDeviceCreate
1515
siteID string
1616
deviceName string
17+
deviceSlug string
1718
}
1819

1920
func buildCmdDeviceCreateStandalone() *cli.Command {
@@ -43,13 +44,18 @@ func (c *cmdDeviceCreateStandalone) Flags() []cli.Flag {
4344
Usage: "name for the new device",
4445
Destination: &c.deviceName,
4546
Required: true,
47+
}, &cli.StringFlag{
48+
Name: "device-slug",
49+
Usage: "slug for the new standalone device",
50+
Destination: &c.deviceSlug,
4651
})
4752
}
4853

4954
func (c *cmdDeviceCreateStandalone) do(ctx context.Context) error {
5055
body, err := json.Marshal(map[string]any{
5156
"site_id": c.siteID,
5257
"name": c.deviceName,
58+
"slug": c.deviceSlug,
5359
})
5460
if err != nil {
5561
return fmt.Errorf("build request: %w", err)

internal/app/enaptercli/testdata/helps/enapter device create standalone

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ OPTIONS:
1010
--verbose log extra details about the operation (default: false)
1111
--site-id value, -s value site ID where the device will be created
1212
--device-name value, -n value name for the new device
13+
--device-slug value slug for the new standalone device
1314
--help, -h show help
1415

1516
ENVIRONMENT VARIABLES:

0 commit comments

Comments
 (0)