Skip to content

feat: implement global flag for org selection #12276

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 26, 2024
Merged

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Feb 23, 2024

What this does

Adds a flag -z <org_name | org_id> that selects a given org. Works on all commands. This allows overriding whatever is in the config setting.

I used -z rather than -o because -o is used for --output.

$ coder organizations current
Current organization: steven-org (9616b384-38bb-4284-861b-8db4fc337d6d)

coder organizations current -z admin
Current organization: admin (653e414b-9eb7-41cb-b11c-38cf90b29db3)

@Emyrk Emyrk force-pushed the stevenmasley/org_flag branch from b1151b0 to a69748c Compare February 23, 2024 01:45
@Emyrk Emyrk requested a review from mafredri February 23, 2024 01:46
@Emyrk Emyrk mentioned this pull request Feb 23, 2024
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Sorry for the delayed review, missed this PR last week.

cli/root.go Outdated
Flag: varOrganizationSelect,
FlagShorthand: "z",
Env: "CODER_ORGANIZATION",
Description: "Select which organization (uuid or name) to use as default. This overrides what is present in the config file.",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Description: "Select which organization (uuid or name) to use as default. This overrides what is present in the config file.",
Description: "Select which organization (uuid or name) to use. This overrides what is present in the config file.",

I think the default terminology here could be confusing.

@Emyrk Emyrk force-pushed the stevenmasley/org_flag branch from fd99c71 to 3eff62a Compare February 26, 2024 15:25
Base automatically changed from stevenmasley/select-org to main February 26, 2024 16:03
Any command can use '-z' to override org context
@Emyrk Emyrk force-pushed the stevenmasley/org_flag branch from 3eff62a to f1fcf31 Compare February 26, 2024 16:08
@Emyrk Emyrk merged commit 748cf4b into main Feb 26, 2024
@Emyrk Emyrk deleted the stevenmasley/org_flag branch February 26, 2024 17:38
@github-actions github-actions bot locked and limited conversation to collaborators Feb 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants