Skip to content

Commit 5a7b94d

Browse files
committed
Added placeholder for userdata
1 parent 7aad33d commit 5a7b94d

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

pkg/cli/commands.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ var Commands = []*Command{
4040
cmdStop,
4141
cmdTag,
4242
cmdTop,
43+
cmdUserdata,
4344
cmdVersion,
4445
cmdWait,
4546
}

pkg/cli/test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var (
1717
"version", "wait",
1818
}
1919
secretCommands []string = []string{
20-
"_patch", "_completion", "_flush-cache",
20+
"_patch", "_completion", "_flush-cache", "_userdata",
2121
}
2222
publicOptions []string = []string{
2323
"-h, --help=false",

pkg/cli/x_userdata.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (C) 2015 Scaleway. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE.md file.
4+
5+
package cli
6+
7+
import "fmt"
8+
9+
var cmdUserdata = &Command{
10+
Exec: runUserdata,
11+
UsageLine: "_userdata [OPTIONS] SERVER [FIELD[=VALUE]]",
12+
Description: "",
13+
Hidden: true,
14+
Help: "List, read and write and delete server's userdata",
15+
Examples: `
16+
$ scw _userdata myserver
17+
$ scw _userdata myserver key
18+
$ scw _userdata myserver key=value
19+
$ scw _userdata myserver key=""
20+
`,
21+
}
22+
23+
func init() {
24+
cmdUserdata.Flag.BoolVar(&userdataHelp, []string{"h", "-help"}, false, "Print usage")
25+
}
26+
27+
// Flags
28+
var userdataHelp bool // -h, --help flag
29+
30+
func runUserdata(cmd *Command, args []string) error {
31+
if userdataHelp {
32+
return cmd.PrintUsage()
33+
}
34+
if len(args) < 1 {
35+
return cmd.PrintShortUsage()
36+
}
37+
38+
fmt.Println("Not implemented")
39+
40+
return nil
41+
}

0 commit comments

Comments
 (0)