Skip to content

Commit 5a1192e

Browse files
committed
Address review comments
Signed-off-by: Manuel Dewald <manuel@codesphere.com>
1 parent 42dd4b9 commit 5a1192e

File tree

16 files changed

+35
-50
lines changed

16 files changed

+35
-50
lines changed

cli/cmd/create-workspace.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ import (
1111

1212
"github.com/codesphere-cloud/cs-go/api"
1313
"github.com/codesphere-cloud/cs-go/pkg/cs"
14-
"github.com/codesphere-cloud/cs-go/pkg/out"
14+
"github.com/codesphere-cloud/cs-go/pkg/io"
1515
"github.com/spf13/cobra"
1616
)
1717

18-
// CreateWorkspaceCmd represents the workspace command
1918
type CreateWorkspaceCmd struct {
2019
cmd *cobra.Command
2120
Opts CreateWorkspaceOpts
@@ -78,15 +77,15 @@ func AddCreateWorkspaceCmd(create *cobra.Command, opts GlobalOptions) {
7877
Use: "workspace",
7978
Short: "Create a workspace",
8079
Args: cobra.RangeArgs(1, 1),
81-
Long: out.Long(`Create a workspace in Codesphere.
80+
Long: io.Long(`Create a workspace in Codesphere.
8281
8382
Specify a (private) git repository or start an empty workspace.
8483
Environment variables can be set to initialize the workspace with a specific environment.
8584
The command will wait for the workspace to become running or a timeout is reached.
8685
8786
To decide which plan suits your needs, run 'cs list plans'
8887
`),
89-
Example: out.FormatExampleCommands("create workspace my-workspace", []out.Example{
88+
Example: io.FormatExampleCommands("create workspace my-workspace", []io.Example{
9089
{Cmd: "-p 20", Desc: "Create an empty workspace, using plan 20"},
9190
{Cmd: "-r https://github.com/codesphere-cloud/landingpage-temp.git", Desc: "Create a workspace from a git repository"},
9291
{Cmd: "-r https://github.com/codesphere-cloud/landingpage-temp.git -e DEPLOYMENT=prod -e A=B", Desc: "Create a workspace and set environment variables"},

cli/cmd/create.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"github.com/spf13/cobra"
88
)
99

10-
// CreateCmd represents the create command
1110
type CreateCmd struct {
1211
cmd *cobra.Command
1312
}

cli/cmd/delete-workspace.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ import (
44
"errors"
55
"fmt"
66

7-
"github.com/codesphere-cloud/cs-go/pkg/out"
7+
"github.com/codesphere-cloud/cs-go/pkg/io"
88
"github.com/spf13/cobra"
99
)
1010

1111
type Prompt interface {
1212
InputPrompt(prompt string) string
1313
}
1414

15-
// DeleteWorkspaceCmd represents the workspace command
1615
type DeleteWorkspaceCmd struct {
1716
cmd *cobra.Command
1817
Opts DeleteWorkspaceOpts
@@ -43,12 +42,12 @@ func AddDeleteWorkspaceCmd(delete *cobra.Command, opts GlobalOptions) {
4342
cmd: &cobra.Command{
4443
Use: "workspace",
4544
Short: "Delete workspace",
46-
Long: out.Long(`Delete workspace after confirmation.
45+
Long: io.Long(`Delete workspace after confirmation.
4746
4847
Confirmation can be given interactively or with the --yes flag`),
4948
},
5049
Opts: DeleteWorkspaceOpts{GlobalOptions: opts},
51-
Prompt: &out.Prompt{},
50+
Prompt: &io.Prompt{},
5251
}
5352
workspace.Opts.Confirmed = workspace.cmd.Flags().Bool("yes", false, "Confirm deletion of workspace")
5453
delete.AddCommand(workspace.cmd)

cli/cmd/delete.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"github.com/spf13/cobra"
55
)
66

7-
// DeleteCmd represents the delete command
87
type DeleteCmd struct {
98
cmd *cobra.Command
109
}

cli/cmd/exec.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ import (
99
"strings"
1010

1111
"github.com/codesphere-cloud/cs-go/pkg/cs"
12-
"github.com/codesphere-cloud/cs-go/pkg/out"
12+
"github.com/codesphere-cloud/cs-go/pkg/io"
1313

1414
"github.com/spf13/cobra"
1515
)
1616

17-
// ExecCmd represents the exec command
1817
type ExecCmd struct {
1918
cmd *cobra.Command
2019
Opts ExecOptions
@@ -44,9 +43,9 @@ func AddExecCmd(rootCmd *cobra.Command, opts GlobalOptions) {
4443
Use: "exec",
4544
Args: cobra.MinimumNArgs(1),
4645
Short: "Run a command in Codesphere workspace",
47-
Long: out.Long(`Run a command in a Codesphere workspace.
46+
Long: io.Long(`Run a command in a Codesphere workspace.
4847
Output will be printed to STDOUT, errors to STDERR.`),
49-
Example: out.FormatExampleCommands("exec", []out.Example{
48+
Example: io.FormatExampleCommands("exec", []io.Example{
5049
{Cmd: "-- echo hello world", Desc: "Print `hello world`"},
5150
{Cmd: "-- find .", Desc: "List all files in workspace"},
5251
{Cmd: "-d user -- find .", Desc: "List all files in the user directory"},

cli/cmd/licenses.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/spf13/cobra"
1212
)
1313

14-
// LicensesCmd represents the licenses command
1514
type LicensesCmd struct {
1615
cmd *cobra.Command
1716
}

cli/cmd/list-plans.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ package cmd
66
import (
77
"fmt"
88

9-
"github.com/codesphere-cloud/cs-go/pkg/out"
9+
"github.com/codesphere-cloud/cs-go/pkg/io"
1010

1111
"github.com/jedib0t/go-pretty/v6/table"
1212
"github.com/jedib0t/go-pretty/v6/text"
1313
"github.com/spf13/cobra"
1414
)
1515

16-
// ListPlansCmd represents the plans command
1716
type ListPlansCmd struct {
1817
cmd *cobra.Command
1918
Opts GlobalOptions
@@ -31,7 +30,7 @@ func (c *ListPlansCmd) RunE(_ *cobra.Command, args []string) error {
3130
return fmt.Errorf("failed to list plans: %s", err)
3231
}
3332

34-
t := out.GetTableWriter()
33+
t := io.GetTableWriter()
3534
t.AppendHeader(table.Row{"ID", "Name", "On Demand", "CPU", "RAM(GiB)", "SSD(GiB)", "Price(USD)", "Max Replicas"})
3635
t.SetColumnConfigs([]table.ColumnConfig{
3736
{Name: "Price(USD)", Align: text.AlignRight},
@@ -71,7 +70,7 @@ func AddListPlansCmd(list *cobra.Command, opts GlobalOptions) {
7170
cmd: &cobra.Command{
7271
Use: "plans",
7372
Short: "List available plans",
74-
Long: out.Long(`List available workpace plans.
73+
Long: io.Long(`List available workpace plans.
7574
7675
When creating new workspaces you need to select a specific plan.`),
7776
},

cli/cmd/list-teams.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"fmt"
88

99
"github.com/codesphere-cloud/cs-go/pkg/cs"
10-
"github.com/codesphere-cloud/cs-go/pkg/out"
10+
"github.com/codesphere-cloud/cs-go/pkg/io"
1111
"github.com/jedib0t/go-pretty/v6/table"
1212

1313
"github.com/spf13/cobra"
@@ -24,7 +24,7 @@ func addListTeamsCmd(p *cobra.Command, opts GlobalOptions) {
2424
Use: "teams",
2525
Short: "List teams",
2626
Long: `List teams available in Codesphere`,
27-
Example: out.FormatExampleCommands("list teams", []out.Example{
27+
Example: io.FormatExampleCommands("list teams", []io.Example{
2828
{Desc: "List all teams"},
2929
}),
3030
},
@@ -45,7 +45,7 @@ func (l *ListTeamsCmd) RunE(_ *cobra.Command, args []string) (err error) {
4545
return fmt.Errorf("failed to list teams: %w", err)
4646
}
4747

48-
t := out.GetTableWriter()
48+
t := io.GetTableWriter()
4949
t.AppendHeader(table.Row{"P", "ID", "Name", "Role", "Default DC"})
5050
for _, team := range teams {
5151
first := ""

cli/cmd/list-workspaces.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"fmt"
88

99
"github.com/codesphere-cloud/cs-go/api"
10-
"github.com/codesphere-cloud/cs-go/pkg/out"
10+
"github.com/codesphere-cloud/cs-go/pkg/io"
1111
"github.com/jedib0t/go-pretty/v6/table"
1212

1313
"github.com/spf13/cobra"
@@ -24,7 +24,7 @@ func addListWorkspacesCmd(p *cobra.Command, opts GlobalOptions) {
2424
Use: "workspaces",
2525
Short: "List workspaces",
2626
Long: `List workspaces available in Codesphere`,
27-
Example: out.FormatExampleCommands("list workspaces", []out.Example{
27+
Example: io.FormatExampleCommands("list workspaces", []io.Example{
2828
{Cmd: "--team-id <team-id>", Desc: "List all workspaces"},
2929
}),
3030
},
@@ -45,7 +45,7 @@ func (l *ListWorkspacesCmd) RunE(_ *cobra.Command, args []string) (err error) {
4545
return fmt.Errorf("failed to list workspaces: %w", err)
4646
}
4747

48-
t := out.GetTableWriter()
48+
t := io.GetTableWriter()
4949
t.AppendHeader(table.Row{"Team ID", "ID", "Name", "Repository"})
5050
for _, w := range workspaces {
5151
gitUrl := ""

cli/cmd/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
package cmd
55

66
import (
7-
"github.com/codesphere-cloud/cs-go/pkg/out"
7+
"github.com/codesphere-cloud/cs-go/pkg/io"
88
"github.com/spf13/cobra"
99
)
1010

@@ -18,7 +18,7 @@ func AddListCmd(rootCmd *cobra.Command, opts GlobalOptions) {
1818
Use: "list",
1919
Short: "List resources",
2020
Long: `List resources available in Codesphere`,
21-
Example: out.FormatExampleCommands("list", []out.Example{
21+
Example: io.FormatExampleCommands("list", []io.Example{
2222
{Cmd: "workspaces", Desc: "List all workspaces"},
2323
}),
2424
},

0 commit comments

Comments
 (0)