Skip to content

Commit 239ae0a

Browse files
ran gofmt
1 parent bc36ab0 commit 239ae0a

76 files changed

Lines changed: 279 additions & 299 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cliChecker/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
sl_plugin "github.ibm.com/SoftLayer/softlayer-cli/plugin"
88
)
99

10-
1110
func main() {
1211
fmt.Printf("IBMCLOUD SL Command Directory\n")
1312

@@ -33,4 +32,4 @@ func main() {
3332
fmt.Printf("\tUsage: %s\n", slCmd.Usage)
3433
fmt.Printf("==============================================================\n")
3534
}
36-
}
35+
}

docs/main.go

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package main
22

33
import (
4+
"encoding/json"
45
"fmt"
56
"os"
6-
"strings"
7-
"encoding/json"
87
"regexp"
8+
"strings"
99

1010
"text/template"
1111
// "sort"
@@ -17,7 +17,7 @@ import (
1717

1818
var fileName string
1919
var rootCmd = &cobra.Command{
20-
Use: "doc-gen",
20+
Use: "doc-gen",
2121
Short: "Generate the documentation for the sl plugin",
2222
RunE: func(Cmd *cobra.Command, args []string) error {
2323
CliDocs()
@@ -39,33 +39,31 @@ func checkError(err error) {
3939

4040
// For top level commands, like `sl account` or `sl hardware`
4141
type SlCmdGroup struct {
42-
Name string
42+
Name string
4343
CommandShortLink string
44-
Commands []SlCmdDoc
45-
Help string
44+
Commands []SlCmdDoc
45+
Help string
4646
}
4747

4848
// For specific commands
4949
type SlCmdDoc struct {
50-
Name string
50+
Name string
5151
CommandShortLink string
52-
Use string
53-
Flags []SlCmdFlag
54-
Help string
55-
LongHelp string
56-
Backtick string
57-
CommandPath string
52+
Use string
53+
Flags []SlCmdFlag
54+
Help string
55+
LongHelp string
56+
Backtick string
57+
CommandPath string
5858
}
5959

6060
// For a commands flags
6161
type SlCmdFlag struct {
62-
Name string
63-
Help string
62+
Name string
63+
Help string
6464
Default string
6565
}
6666

67-
68-
6967
// This function builds the documentation for IBMCLOUD docs
7068
func CliDocs() {
7169
// fmt.Printf("IBMCLOUD SL Command Directory\n")
@@ -75,11 +73,10 @@ func CliDocs() {
7573
shortName := strings.ReplaceAll(iCmd.Name(), " ", "_")
7674
shortName = strings.ReplaceAll(iCmd.Name(), "-", "_")
7775
thisCmdGroup := SlCmdGroup{
78-
Name: iCmd.Name(),
76+
Name: iCmd.Name(),
7977
CommandShortLink: fmt.Sprintf("sl_%v", shortName),
80-
Commands: nil,
81-
Help: iCmd.Short,
82-
78+
Commands: nil,
79+
Help: iCmd.Short,
8380
}
8481
if len(iCmd.Commands()) > 0 {
8582
thisCmdGroup.Commands = buildSlCmdDoc(iCmd)
@@ -93,7 +90,7 @@ func CliDocs() {
9390
jOut, err := json.MarshalIndent(CmdGroups, "", " ")
9491
checkError(err)
9592
err = os.WriteFile("sl.json", jOut, 0755) //#nosec G306 -- This is a false positive
96-
checkError(err)
93+
checkError(err)
9794
// fmt.Println(string(jOut))
9895
}
9996

@@ -172,14 +169,14 @@ func cobraToSl(iCmd *cobra.Command, tlcmd string) SlCmdDoc {
172169
shortName = strings.ReplaceAll(shortName, "-", "_")
173170
longHelp := getLongHelp(iCmd.Long)
174171
thisDoc := SlCmdDoc{
175-
Name: iCmd.Name(),
172+
Name: iCmd.Name(),
176173
CommandShortLink: shortName,
177-
CommandPath: iCmd.CommandPath(),
178-
Use: iCmd.UseLine(),
179-
Flags: nil,
180-
Help: iCmd.Short,
181-
LongHelp: longHelp,
182-
Backtick: "```",
174+
CommandPath: iCmd.CommandPath(),
175+
Use: iCmd.UseLine(),
176+
Flags: nil,
177+
Help: iCmd.Short,
178+
LongHelp: longHelp,
179+
Backtick: "```",
183180
}
184181
thisDoc.Flags = buildSlCmdFlag(iCmd)
185182

@@ -196,8 +193,8 @@ func buildSlCmdFlag(topCommand *cobra.Command) []SlCmdFlag {
196193
flagName = fmt.Sprintf("%s, %s", pflag.Shorthand, flagName)
197194
}
198195
thisFlag := SlCmdFlag{
199-
Name:flagName,
200-
Help: getFlagHelp(pflag.Usage),
196+
Name: flagName,
197+
Help: getFlagHelp(pflag.Usage),
201198
Default: pflag.DefValue,
202199
}
203200
flags = append(flags, thisFlag)

plugin/commands/bandwidth/pools_edit_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package bandwidth_test
22

33
import (
4-
54
"errors"
65

76
"github.com/IBM-Cloud/ibm-cloud-cli-sdk/testhelpers/terminal"

plugin/commands/block/object_storage_detail.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ func (cmd *ObjectStorageDetailCommand) Run(args []string) error {
5555
map[string]interface{}{"StorageID": storageID}), err.Error(), 2)
5656
}
5757

58-
59-
6058
table := cmd.UI.Table([]string{
6159
T("Name"),
6260
T("Value"),

plugin/commands/block/volume_detail.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ func (cmd *VolumeDetailCommand) Run(args []string) error {
136136
}
137137
table.Add(T("Notes"), decodedValue)
138138
hasEncryption := T("False")
139-
if (blockVolume.HasEncryptionAtRest != nil && *blockVolume.HasEncryptionAtRest == true) {
139+
if blockVolume.HasEncryptionAtRest != nil && *blockVolume.HasEncryptionAtRest == true {
140140
hasEncryption = T("True")
141-
}
141+
}
142142
table.Add(T("Encrypted"), hasEncryption)
143143
table.Print()
144144
return nil

plugin/commands/block/volume_detail_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ import (
1414

1515
var _ = Describe("Block Volume-Detail Tests", func() {
1616
var (
17-
fakeUI *terminal.FakeUI
18-
cliCommand *block.VolumeDetailCommand
17+
fakeUI *terminal.FakeUI
18+
cliCommand *block.VolumeDetailCommand
1919
fakeSession *session.Session
2020
fakeHandler *testhelpers.FakeTransportHandler
21-
slCommand *metadata.SoftlayerStorageCommand
21+
slCommand *metadata.SoftlayerStorageCommand
2222
)
2323
BeforeEach(func() {
2424
fakeUI = terminal.NewFakeUI()

plugin/commands/cdn/cdn_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var _ = Describe("Test cdn commands", func() {
3737

3838
Context("New commands testable", func() {
3939
commands := cdn.SetupCobraCommands(slMeta)
40-
40+
4141
var arrayCommands = []string{}
4242
for _, command := range commands.Commands() {
4343
commandName := command.Name()

plugin/commands/cdn/origin_add_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ var _ = Describe("Cdn origin add", func() {
7777

7878
Context("Cdn origin add, correct use", func() {
7979
It("return cdn origin add", func() {
80-
err := testhelpers.RunCobraCommand(cliCommand.Command, "123456789", "--origin", "123.123.123.123","--path", "/example/videos/", "--http", "80", "--origin-type", "storage", "--bucket-name", "bucketName", "--file-extensions", "jpg")
80+
err := testhelpers.RunCobraCommand(cliCommand.Command, "123456789", "--origin", "123.123.123.123", "--path", "/example/videos/", "--http", "80", "--origin-type", "storage", "--bucket-name", "bucketName", "--file-extensions", "jpg")
8181
Expect(err).NotTo(HaveOccurred())
8282
Expect(fakeUI.Outputs()).To(ContainSubstring("CDN Unique ID"))
8383
Expect(fakeUI.Outputs()).To(ContainSubstring("354034879028850"))
@@ -95,7 +95,7 @@ var _ = Describe("Cdn origin add", func() {
9595
Expect(fakeUI.Outputs()).To(ContainSubstring("RUNNING"))
9696
})
9797
It("return cdn in format json", func() {
98-
err := testhelpers.RunCobraCommand(cliCommand.Command, "123456789", "--origin", "123.123.123.123","--path", "/example/videos/", "--http", "80", "--output", "json")
98+
err := testhelpers.RunCobraCommand(cliCommand.Command, "123456789", "--origin", "123.123.123.123", "--path", "/example/videos/", "--http", "80", "--output", "json")
9999
Expect(err).NotTo(HaveOccurred())
100100
Expect(fakeUI.Outputs()).To(ContainSubstring(`"Name": "CDN Unique ID",`))
101101
Expect(fakeUI.Outputs()).To(ContainSubstring(`"Value": "354034879028850"`))

plugin/commands/dedicatedhost/create.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package dedicatedhost
22

33
import (
44
"github.com/spf13/cobra"
5-
65

76
slErr "github.ibm.com/SoftLayer/softlayer-cli/plugin/errors"
87
. "github.ibm.com/SoftLayer/softlayer-cli/plugin/i18n"

plugin/commands/dedicatedhost/detail.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func NewDetailCommand(sl *metadata.SoftlayerCommand) *DetailCommand {
3030
cobraCmd := &cobra.Command{
3131
Use: "detail " + T("IDENTIFIER"),
3232
Short: T("Get details for a dedicated host."),
33-
Args: metadata.OneArgs,
33+
Args: metadata.OneArgs,
3434
RunE: func(cmd *cobra.Command, args []string) error {
3535
return thisCmd.Run(args)
3636
},

0 commit comments

Comments
 (0)