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

feat:coder ls should show possible columns to filter by#4240

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
endingwithali merged 2 commits intomainfromendingwithali/column-search-feature
Sep 28, 2022

Conversation

endingwithali
Copy link
Contributor

Solves feature request for#1432

kylecarbs reacted with eyes emoji
@endingwithaliendingwithali self-assigned thisSep 28, 2022
@endingwithaliendingwithali added the cliArea: CLI labelSep 28, 2022
@endingwithaliendingwithali requested a review froma teamSeptember 28, 2022 14:37
Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

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

Paired with Ali on this. TheReflect() piece is just to get the struct fields on the workspace.
Requesting other eyes but we both tested this together and it works fine from what I can tell.

Comment on lines +88 to +94
if me {
myUser, err := client.User(cmd.Context(), codersdk.Me)
if err != nil {
return err
}
filter.Owner = myUser.Username
}
Copy link
Member

Choose a reason for hiding this comment

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

review: this might be a left-over piece of a merge conflict

Copy link
Member

@deansheatherdeansheather left a comment

Choose a reason for hiding this comment

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

LGTM but it'd be better if it were a set of reusable functions instead :)

Comment on lines +131 to +139
v := reflect.Indirect(reflect.ValueOf(displayWorkspaces))
availColumns, err := cliui.TypeToTableHeaders(v.Type().Elem())
if err != nil {
panic(err)
}
for i, s := range availColumns {
availColumns[i] = strings.Replace(s, " ", "_", -1)
}
columnString := strings.Join(availColumns[:], ", ")
Copy link
Member

Choose a reason for hiding this comment

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

This is good, but since we'd probably want to use this in multiple commands it would be better served as a function in the cliui package that acceptsany:

funcTableHeaders(tany) ([]string,error) {v:=reflect.Indirect(reflect.ValueOf(t))returncliui.TypeToTableHeaders(v.Type())}funcFormatColumnNames(columns []string)string {out:=strings.Join(columns[:],", ")out=strings.ReplaceAll(out," ","_")returnout}

which could be called like

columns,err:=cliui.TableHeaders(workspaceListRow{})iferr!=nil {panic(err)}columnString:=cliui.FormatColumnNames(columns)

This would also remove the need for having a global(ish) var for the output

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

future fix ideaaa :D

@endingwithaliendingwithali merged commit0c75ea6 intomainSep 28, 2022
@endingwithaliendingwithali deleted the endingwithali/column-search-feature branchSeptember 28, 2022 20:39
johnstcn added a commit that referenced this pull requestSep 29, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@deansheatherdeansheatherdeansheather left review comments

Assignees

@endingwithaliendingwithali

Labels
cliArea: CLI
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@endingwithali@johnstcn@deansheather

[8]ページ先頭

©2009-2025 Movatter.jp