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

chore: remove org context switcher in the cli#13674

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
Emyrk merged 14 commits intomainfromstevenmasley/unified_org_cli
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from1 commit
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
PrevPrevious commit
NextNext commit
add shorthand
  • Loading branch information
@Emyrk
Emyrk committedJun 26, 2024
commit8a86eb0a2e38799399b06ca04739e3e5381eabaa
6 changes: 3 additions & 3 deletionscli/organization_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,7 @@ func TestCurrentOrganization(t *testing.T) {
defer srv.Close()

client := codersdk.New(must(url.Parse(srv.URL)))
inv, root := clitest.New(t, "organizations", "show", "current")
inv, root := clitest.New(t, "organizations", "show", "selected")
clitest.SetupConfig(t, client, root)
pty := ptytest.New(t).Attach(inv)
errC := make(chan error)
Expand All@@ -70,7 +70,7 @@ func TestCurrentOrganization(t *testing.T) {
require.NoError(t, err)
}

inv, root := clitest.New(t, "organizations", "show", "--only-id")
inv, root := clitest.New(t, "organizations", "show", "--only-id", "--org="+first.OrganizationID.String())
clitest.SetupConfig(t, client, root)
pty := ptytest.New(t).Attach(inv)
errC := make(chan error)
Expand DownExpand Up@@ -101,7 +101,7 @@ func TestCurrentOrganization(t *testing.T) {
orgs[orgName] = org
}

inv, root := clitest.New(t, "organizations", "show", "current", "--only-id", "-z=bar")
inv, root := clitest.New(t, "organizations", "show", "selected", "--only-id", "-z=bar")
clitest.SetupConfig(t, client, root)
pty := ptytest.New(t).Attach(inv)
errC := make(chan error)
Expand Down
76 changes: 33 additions & 43 deletionscli/root.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,20 +53,19 @@ var (
)

const (
varURL = "url"
varToken = "token"
varAgentToken = "agent-token"
varAgentTokenFile = "agent-token-file"
varAgentURL = "agent-url"
varHeader = "header"
varHeaderCommand = "header-command"
varNoOpen = "no-open"
varNoVersionCheck = "no-version-warning"
varNoFeatureWarning = "no-feature-warning"
varForceTty = "force-tty"
varVerbose = "verbose"
varOrganizationSelect = "organization"
varDisableDirect = "disable-direct-connections"
varURL = "url"
varToken = "token"
varAgentToken = "agent-token"
varAgentTokenFile = "agent-token-file"
varAgentURL = "agent-url"
varHeader = "header"
varHeaderCommand = "header-command"
varNoOpen = "no-open"
varNoVersionCheck = "no-version-warning"
varNoFeatureWarning = "no-feature-warning"
varForceTty = "force-tty"
varVerbose = "verbose"
varDisableDirect = "disable-direct-connections"

notLoggedInMessage = "You are not logged in. Try logging in using 'coder login <url>'."

Expand DownExpand Up@@ -452,15 +451,6 @@ func (r *RootCmd) Command(subcommands []*serpent.Command) (*serpent.Command, err
Value: serpent.StringOf(&r.globalConfig),
Group: globalGroup,
},
{
Flag: varOrganizationSelect,
FlagShorthand: "z",
Env: "CODER_ORGANIZATION",
Description: "Select which organization (uuid or name) to use This overrides what is present in the config file.",
Value: serpent.StringOf(&r.organizationSelect),
Hidden: true,
Group: globalGroup,
},
{
Flag: "version",
// This was requested by a customer to assist with their migration.
Expand All@@ -477,21 +467,20 @@ func (r *RootCmd) Command(subcommands []*serpent.Command) (*serpent.Command, err

// RootCmd contains parameters and helpers useful to all commands.
type RootCmd struct {
clientURL *url.URL
token string
globalConfig string
header []string
headerCommand string
agentToken string
agentTokenFile string
agentURL *url.URL
forceTTY bool
noOpen bool
verbose bool
organizationSelect string
versionFlag bool
disableDirect bool
debugHTTP bool
clientURL *url.URL
token string
globalConfig string
header []string
headerCommand string
agentToken string
agentTokenFile string
agentURL *url.URL
forceTTY bool
noOpen bool
verbose bool
versionFlag bool
disableDirect bool
debugHTTP bool

noVersionCheck bool
noFeatureWarning bool
Expand DownExpand Up@@ -645,13 +634,14 @@ func NewOrganizationContext() *OrganizationContext {
func (o *OrganizationContext) AttachOptions(cmd *serpent.Command) {
cmd.Options = append(cmd.Options, serpent.Option{
Name: "Organization",
Description: "Set the organizationfor the command to use.",
Description: "Select which organization(uuid or name) to use.",
// Only required if the user is a part of more than 1 organization.
// Otherwise, we can assume a default value.
Required: false,
Flag: "org",
Env: "CODER_ORGANIZATION",
Value: serpent.StringOf(&o.FlagSelect),
Required: false,
Flag: "org",
FlagShorthand: "z",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

-z is a really weird choice here imo. I know-o is used, but what about-O? just doesn't feel like there is very clear connection.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I was thinking organiZation lol. I can switch to-O

Kira-Pilot reacted with laugh emoji
Env: "CODER_ORGANIZATION",
Value: serpent.StringOf(&o.FlagSelect),
})
}

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp