-
Notifications
You must be signed in to change notification settings - Fork 12
mass bundle list #209
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
mass bundle list #209
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| --- | ||
| id: mass_bundle_list.md | ||
| slug: /cli/commands/mass_bundle_list | ||
| title: Mass Bundle List | ||
| sidebar_label: Mass Bundle List | ||
| --- | ||
| ## mass bundle list | ||
|
|
||
| List bundles in your organization | ||
|
|
||
| ### Synopsis | ||
|
|
||
| # List bundles in your organization | ||
|
|
||
| List all bundle repositories with optional search, sort, and limit. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```bash | ||
| mass bundle list [flags] | ||
| ``` | ||
|
|
||
| ## Flags | ||
|
|
||
| - `--search, -s`: Search bundles using Google-style operators (AND, OR, -, quotes) | ||
| - `--sort`: Sort field (name, created_at). Defaults to "name" | ||
| - `--order`: Sort order (asc, desc). Defaults to "asc" | ||
| - `--limit, -l`: Maximum number of results to return | ||
| - `--output, -o`: Output format (table or json). Defaults to "table" | ||
|
|
||
| ## Examples | ||
|
|
||
| ```bash | ||
| # List all bundles | ||
| mass bundle list | ||
|
|
||
| # Search for postgres bundles | ||
| mass bundle list --search postgres | ||
|
|
||
| # Search with operators | ||
| mass bundle list --search "postgres AND aws -aurora" | ||
|
|
||
| # Sort by creation date, newest first | ||
| mass bundle list --sort created_at --order desc | ||
|
|
||
| # Limit results | ||
| mass bundle list --limit 10 | ||
|
|
||
| # Output as JSON | ||
| mass bundle list -o json | ||
| ``` | ||
|
|
||
|
|
||
| ``` | ||
| mass bundle list [flags] | ||
| ``` | ||
|
|
||
| ### Options | ||
|
|
||
| ``` | ||
| -h, --help help for list | ||
| -l, --limit int Maximum number of results to return | ||
| --order string Sort order (asc, desc) (default "asc") | ||
| -o, --output string Output format (table, json) (default "table") | ||
| -s, --search string Search bundles (supports AND, OR, -, quotes) | ||
| --sort string Sort field (name, created_at) (default "name") | ||
| ``` | ||
|
|
||
| ### SEE ALSO | ||
|
|
||
| * [mass bundle](/cli/commands/mass_bundle) - Generate and publish bundles |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # List bundles in your organization | ||
|
|
||
| List all bundle repositories with optional search, sort, and limit. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```bash | ||
| mass bundle list [flags] | ||
| ``` | ||
|
|
||
| ## Flags | ||
|
|
||
| - `--search, -s`: Search bundles using Google-style operators (AND, OR, -, quotes) | ||
| - `--sort`: Sort field (name, created_at). Defaults to "name" | ||
| - `--order`: Sort order (asc, desc). Defaults to "asc" | ||
| - `--limit, -l`: Maximum number of results to return | ||
| - `--output, -o`: Output format (table or json). Defaults to "table" | ||
|
|
||
| ## Examples | ||
|
|
||
| ```bash | ||
| # List all bundles | ||
| mass bundle list | ||
|
|
||
| # Search for postgres bundles | ||
| mass bundle list --search postgres | ||
|
|
||
| # Search with operators | ||
| mass bundle list --search "postgres AND aws -aurora" | ||
|
|
||
| # Sort by creation date, newest first | ||
| mass bundle list --sort created_at --order desc | ||
|
|
||
| # Limit results | ||
| mass bundle list --limit 10 | ||
|
|
||
| # Output as JSON | ||
| mass bundle list -o json | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| package api | ||
|
|
||
| //go:generate go run github.com/Khan/genqlient@v0.6.0 | ||
| //go:generate genqlient |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,94 @@ | ||
| package api | ||
|
|
||
| import ( | ||
| "context" | ||
| "time" | ||
|
|
||
| "github.com/massdriver-cloud/mass/pkg/api/scalars" | ||
| "github.com/massdriver-cloud/massdriver-sdk-go/massdriver/client" | ||
| ) | ||
|
|
||
| // Repo represents a bundle repository | ||
| type Repo struct { | ||
| ID string `json:"id"` | ||
| Name string `json:"name"` | ||
| CreatedAt time.Time `json:"createdAt"` | ||
| ReleaseChannels []ReleaseChannel `json:"releaseChannels"` | ||
| } | ||
|
|
||
| // ReleaseChannel represents a release channel | ||
| type ReleaseChannel struct { | ||
| Name string `json:"name"` | ||
| Tag string `json:"tag"` | ||
| } | ||
|
|
||
| // ReposPage represents a page of repos with pagination info | ||
| type ReposPage struct { | ||
| Items []Repo `json:"items"` | ||
| NextCursor string `json:"nextCursor,omitempty"` | ||
| PrevCursor string `json:"prevCursor,omitempty"` | ||
| } | ||
|
|
||
| // ReposListOptions contains options for listing repos | ||
| type ReposListOptions struct { | ||
| Search string | ||
| SortField string // "name" or "created_at" | ||
| SortOrder string // "asc" or "desc" | ||
| Limit int | ||
| } | ||
|
|
||
| // ListRepos lists bundle repositories with optional search, sort, and pagination | ||
| func ListRepos(ctx context.Context, mdClient *client.Client, opts ReposListOptions) (*ReposPage, error) { | ||
| var sort *ReposSort | ||
| if opts.SortField != "" || opts.SortOrder != "" { | ||
| s := ReposSort{ | ||
| Field: ReposSortFieldName, | ||
| Order: SortOrderAsc, | ||
| } | ||
| if opts.SortField == "created_at" { | ||
| s.Field = ReposSortFieldCreatedAt | ||
| } | ||
| if opts.SortOrder == "desc" { | ||
| s.Order = SortOrderDesc | ||
| } | ||
| sort = &s | ||
| } | ||
|
|
||
| var cursor *scalars.Cursor | ||
| if opts.Limit > 0 { | ||
| cursor = &scalars.Cursor{ | ||
| Limit: opts.Limit, | ||
| } | ||
| } | ||
|
|
||
| var search *string | ||
| if opts.Search != "" { | ||
| search = &opts.Search | ||
| } | ||
|
|
||
| response, err := listRepos(ctx, mdClient.GQL, mdClient.Config.OrganizationID, sort, cursor, search) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| page := &ReposPage{ | ||
| Items: make([]Repo, 0, len(response.Repos.Items)), | ||
| NextCursor: response.Repos.Cursor.Next, | ||
| PrevCursor: response.Repos.Cursor.Previous, | ||
| } | ||
|
|
||
| for _, item := range response.Repos.Items { | ||
| repo := Repo{ | ||
| ID: item.Id, | ||
| Name: item.Name, | ||
| CreatedAt: item.CreatedAt, | ||
| ReleaseChannels: make([]ReleaseChannel, 0, len(item.ReleaseChannels)), | ||
| } | ||
| for _, rc := range item.ReleaseChannels { | ||
| repo.ReleaseChannels = append(repo.ReleaseChannels, ReleaseChannel(rc)) | ||
| } | ||
| page.Items = append(page.Items, repo) | ||
| } | ||
|
|
||
| return page, nil | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.