Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

coder licenses add CLI command#3632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
spikecurtis merged 5 commits intomainfromspike/3279_add_license_cli
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletioncli/clitest/clitest.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,7 +21,13 @@ import (
// New creates a CLI instance with a configuration pointed to a
// temporary testing directory.
func New(t *testing.T, args ...string) (*cobra.Command, config.Root) {
cmd := cli.Root(cli.AGPL())
return NewWithSubcommands(t, cli.AGPL(), args...)
}

func NewWithSubcommands(
t *testing.T, subcommands []*cobra.Command, args ...string,
) (*cobra.Command, config.Root) {
cmd := cli.Root(subcommands)
dir := t.TempDir()
root := config.Root(dir)
cmd.SetArgs(append([]string{"--global-config", dir}, args...))
Expand Down
2 changes: 1 addition & 1 deletioncli/configssh.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -158,7 +158,7 @@ func configSSH() *cobra.Command {
),
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, _ []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/create.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@ func create() *cobra.Command {
Use: "create [name]",
Short: "Create a workspace from a template",
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/delete.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,7 +28,7 @@ func deleteWorkspace() *cobra.Command {
return err
}

client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/features.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,7 +36,7 @@ func featuresList() *cobra.Command {
Use: "list",
Aliases: []string{"ls"},
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/list.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -65,7 +65,7 @@ func list() *cobra.Command {
Aliases: []string{"ls"},
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/logout.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,7 @@ func logout() *cobra.Command {
Use: "logout",
Short: "Remove the local authenticated session",
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/parameterslist.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,7 +22,7 @@ func parameterList() *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
scope, name := args[0], args[1]

client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/portforward.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -70,7 +70,7 @@ func portForward() *cobra.Command {
return xerrors.New("no port-forwards requested")
}

client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/publickey.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@ func publickey() *cobra.Command {
Aliases: []string{"pubkey"},
Short: "Output your public key for Git operations",
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return xerrors.Errorf("create codersdk client: %w", err)
}
Expand Down
8 changes: 4 additions & 4 deletionscli/root.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -114,7 +114,7 @@ func Root(subcommands []*cobra.Command) *cobra.Command {
return nil
}

client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
// If the client is unauthenticated we can ignore the check.
// The child commands should handle an unauthenticated client.
if xerrors.Is(err, errUnauthenticated) {
Expand DownExpand Up@@ -190,9 +190,9 @@ func isTest() bool {
return flag.Lookup("test.v") != nil
}

//createClient returns a new client from the command context.
//CreateClient returns a new client from the command context.
// It reads from global configuration files if flags are not set.
funccreateClient(cmd *cobra.Command) (*codersdk.Client, error) {
funcCreateClient(cmd *cobra.Command) (*codersdk.Client, error) {
root := createConfig(cmd)
rawURL, err := cmd.Flags().GetString(varURL)
if err != nil || rawURL == "" {
Expand DownExpand Up@@ -226,7 +226,7 @@ func createClient(cmd *cobra.Command) (*codersdk.Client, error) {
}

// createAgentClient returns a new client from the command context.
// It works just likecreateClient, but uses the agent token and URL instead.
// It works just likeCreateClient, but uses the agent token and URL instead.
func createAgentClient(cmd *cobra.Command) (*codersdk.Client, error) {
rawURL, err := cmd.Flags().GetString(varAgentURL)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletionscli/schedule.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -77,7 +77,7 @@ func scheduleShow() *cobra.Command {
Long: scheduleShowDescriptionLong,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand DownExpand Up@@ -106,7 +106,7 @@ func scheduleStart() *cobra.Command {
Long: scheduleStartDescriptionLong,
Args: cobra.RangeArgs(2, 4),
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand DownExpand Up@@ -156,7 +156,7 @@ func scheduleStop() *cobra.Command {
Short: "Edit workspace stop schedule",
Long: scheduleStopDescriptionLong,
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand DownExpand Up@@ -207,7 +207,7 @@ func scheduleOverride() *cobra.Command {
return err
}

client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return xerrors.Errorf("create client: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletioncli/show.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,7 @@ func show() *cobra.Command {
Short: "Show details of a workspace's resources and agents",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/ssh.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -54,7 +54,7 @@ func ssh() *cobra.Command {
ctx, cancel := context.WithCancel(cmd.Context())
defer cancel()

client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/start.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,7 +17,7 @@ func start() *cobra.Command {
Short: "Build a workspace with the start state",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletionscli/state.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@ func statePull() *cobra.Command {
Use: "pull <workspace> [file]",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand DownExpand Up@@ -68,7 +68,7 @@ func statePush() *cobra.Command {
Use: "push <workspace> <file>",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/stop.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ func stop() *cobra.Command {
return err
}

client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/templatecreate.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,7 @@ func templateCreate() *cobra.Command {
Short: "Create a template from the current directory or as specified by flag",
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/templatedelete.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,7 @@ func templateDelete() *cobra.Command {
templates = []codersdk.Template{}
)

client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/templateedit.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ func templateEdit() *cobra.Command {
Args: cobra.ExactArgs(1),
Short: "Edit the metadata of a template by name.",
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return xerrors.Errorf("create client: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletioncli/templatelist.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,7 @@ func templateList() *cobra.Command {
Short: "List all the templates available for the organization",
Aliases: []string{"ls"},
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/templatepull.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@ func templatePull() *cobra.Command {
dest = args[1]
}

client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return xerrors.Errorf("create client: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletioncli/templatepush.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@ func templatePush() *cobra.Command {
Args: cobra.MaximumNArgs(1),
Short: "Push a new template version from the current directory or as specified by flag",
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/templateversions.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ func templateVersionsList() *cobra.Command {
Args: cobra.ExactArgs(1),
Short: "List all the versions of the specified template",
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return xerrors.Errorf("create client: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletioncli/update.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,7 +22,7 @@ func update() *cobra.Command {
Args: cobra.ExactArgs(1),
Short: "Update a workspace to the latest template version",
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/usercreate.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,7 +21,7 @@ func userCreate() *cobra.Command {
cmd := &cobra.Command{
Use: "create",
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletionscli/userlist.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,7 @@ func userList() *cobra.Command {
Use: "list",
Aliases: []string{"ls"},
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand DownExpand Up@@ -76,7 +76,7 @@ func userSingle() *cobra.Command {
),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/userstatus.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,7 @@ func createUserStatusCommand(sdkStatus codersdk.UserStatus) *cobra.Command {
},
),
RunE: func(cmd *cobra.Command, args []string) error {
client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletioncli/wireguardtunnel.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,7 +67,7 @@ func wireguardPortForward() *cobra.Command {
return xerrors.New("no port-forwards requested")
}

client, err :=createClient(cmd)
client, err :=CreateClient(cmd)
if err != nil {
return err
}
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp