Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions docs/atlascli/command/atlas-alerts-settings-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Options
- Type
- Required
- Description
* - -c, --compact
Copy link
Member

Choose a reason for hiding this comment

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

--compact as name and description suggests feature but in reality is introduced only to support backward compatibility. Names are hard but if we can add something more descriptive:

--legacy-output
--old-format

Etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure I'm happy to go with that

Copy link
Member

Choose a reason for hiding this comment

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

Chatted offline. Compact seems much better as we do not use old SDK and this flag can stay with us without removal

-
- false
- Flag that enables the compact array response structure for a json output. The --compact option returns array objects as top-level responses and allows backward compatibility for scripts based on previous CLI versions. Omitting the --compact option for a json output returns array objects within a 'results' sub-array. You must specify --output json to use this option.
* - -h, --help
-
- false
Expand Down
4 changes: 4 additions & 0 deletions docs/atlascli/command/atlas-dbusers-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Options
- Type
- Required
- Description
* - -c, --compact
Copy link
Member

Choose a reason for hiding this comment

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

I might be missing context. Did we agree for this flag to be present in docs (not hidden?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Jakub flagged that he wanted a note in --help for affected commands, which for me implies that it should be present in docs

Add note to --help for affected commands that provide a short explanation for the relevant (affected) CLI versions

-
- false
- Flag that enables the compact array response structure for a json output. The --compact option returns array objects as top-level responses and allows backward compatibility for scripts based on previous CLI versions. Omitting the --compact option for a json output returns array objects within a 'results' sub-array. You must specify --output json to use this option.
* - -h, --help
-
- false
Expand Down
4 changes: 4 additions & 0 deletions docs/atlascli/command/atlas-organizations-apiKeys-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Options
- Type
- Required
- Description
* - -c, --compact
-
- false
- Flag that enables the compact array response structure for a json output. The --compact option returns array objects as top-level responses and allows backward compatibility for scripts based on previous CLI versions. Omitting the --compact option for a json output returns array objects within a 'results' sub-array. You must specify --output json to use this option.
* - -h, --help
-
- false
Expand Down
4 changes: 4 additions & 0 deletions docs/atlascli/command/atlas-processes-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Options
- Type
- Required
- Description
* - -c, --compact
-
- false
- Flag that enables the compact array response structure for a json output. The --compact option returns array objects as top-level responses and allows backward compatibility for scripts based on previous CLI versions. Omitting the --compact option for a json output returns array objects within a 'results' sub-array. You must specify --output json to use this option.
* - -h, --help
-
- false
Expand Down
4 changes: 4 additions & 0 deletions docs/atlascli/command/atlas-projects-apiKeys-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Options
- Type
- Required
- Description
* - -c, --compact
-
- false
- Flag that enables the compact array response structure for a json output. The --compact option returns array objects as top-level responses and allows backward compatibility for scripts based on previous CLI versions. Omitting the --compact option for a json output returns array objects within a 'results' sub-array. You must specify --output json to use this option.
* - -h, --help
-
- false
Expand Down
4 changes: 4 additions & 0 deletions docs/atlascli/command/atlas-projects-users-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Options
- Type
- Required
- Description
* - -c, --compact
-
- false
- Flag that enables the compact array response structure for a json output. The --compact option returns array objects as top-level responses and allows backward compatibility for scripts based on previous CLI versions. Omitting the --compact option for a json output returns array objects within a 'results' sub-array. You must specify --output json to use this option.
* - -h, --help
-
- false
Expand Down
4 changes: 4 additions & 0 deletions docs/atlascli/command/atlas-teams-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Options
- Type
- Required
- Description
* - -c, --compact
-
- false
- Flag that enables the compact array response structure for a json output. The --compact option returns array objects as top-level responses and allows backward compatibility for scripts based on previous CLI versions. Omitting the --compact option for a json output returns array objects within a 'results' sub-array. You must specify --output json to use this option.
* - -h, --help
-
- false
Expand Down
4 changes: 4 additions & 0 deletions docs/atlascli/command/atlas-teams-users-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Options
- Type
- Required
- Description
* - -c, --compact
-
- false
- Flag that enables the compact array response structure for a json output. The --compact option returns array objects as top-level responses and allows backward compatibility for scripts based on previous CLI versions. Omitting the --compact option for a json output returns array objects within a 'results' sub-array. You must specify --output json to use this option.
* - -h, --help
-
- false
Expand Down
4 changes: 4 additions & 0 deletions docs/mongocli/command/mongocli-atlas-dbusers-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Options
- Type
- Required
- Description
* - -c, --compact
-
- false
- Flag that enables the compact array response structure for a json output. The --compact option returns array objects as top-level responses and allows backward compatibility for scripts based on previous CLI versions. Omitting the --compact option for a json output returns array objects within a 'results' sub-array. You must specify --output json to use this option.
* - -h, --help
-
- false
Expand Down
4 changes: 4 additions & 0 deletions docs/mongocli/command/mongocli-atlas-processes-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Options
- Type
- Required
- Description
* - -c, --compact
-
- false
- Flag that enables the compact array response structure for a json output. The --compact option returns array objects as top-level responses and allows backward compatibility for scripts based on previous CLI versions. Omitting the --compact option for a json output returns array objects within a 'results' sub-array. You must specify --output json to use this option.
* - -h, --help
-
- false
Expand Down
8 changes: 7 additions & 1 deletion internal/cli/atlas/alerts/settings/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ type ListOpts struct {
cli.GlobalOpts
cli.OutputOpts
cli.ListOpts
store store.AlertConfigurationLister
CompactResponse bool
store store.AlertConfigurationLister
}

func (opts *ListOpts) initStore(ctx context.Context) func() error {
Expand All @@ -58,6 +59,10 @@ func (opts *ListOpts) Run() error {
return err
}

if opts.CompactResponse {
return opts.PrintForCompactResultsResponse(r)
}

return opts.Print(r)
}

Expand Down Expand Up @@ -90,6 +95,7 @@ func ListBuilder() *cobra.Command {

cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID)
cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut)
cmd.Flags().BoolVarP(&opts.CompactResponse, flag.CompactResponse, flag.CompactResponseShort, false, usage.CompactResponse)
_ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag())

return cmd
Expand Down
8 changes: 7 additions & 1 deletion internal/cli/atlas/dbusers/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ type ListOpts struct {
cli.GlobalOpts
cli.OutputOpts
cli.ListOpts
store store.DatabaseUserLister
CompactResponse bool
store store.DatabaseUserLister
}

func (opts *ListOpts) initStore(ctx context.Context) func() error {
Expand All @@ -53,6 +54,10 @@ func (opts *ListOpts) Run() error {
return err
}

if opts.CompactResponse {
return opts.PrintForCompactResultsResponse(r)
}

return opts.Print(r)
}

Expand Down Expand Up @@ -84,6 +89,7 @@ func ListBuilder() *cobra.Command {

cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID)
cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut)
cmd.Flags().BoolVarP(&opts.CompactResponse, flag.CompactResponse, flag.CompactResponseShort, false, usage.CompactResponse)
_ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag())

return cmd
Expand Down
8 changes: 7 additions & 1 deletion internal/cli/atlas/organizations/apikeys/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ type ListOpts struct {
cli.GlobalOpts
cli.OutputOpts
cli.ListOpts
store store.OrganizationAPIKeyLister
CompactResponse bool
store store.OrganizationAPIKeyLister
}

func (opts *ListOpts) initStore(ctx context.Context) func() error {
Expand All @@ -53,6 +54,10 @@ func (opts *ListOpts) Run() error {
return err
}

if opts.CompactResponse {
return opts.PrintForCompactResultsResponse(r)
}

return opts.Print(r)
}

Expand Down Expand Up @@ -84,6 +89,7 @@ func ListBuilder() *cobra.Command {

cmd.Flags().StringVar(&opts.OrgID, flag.OrgID, "", usage.OrgID)
cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut)
cmd.Flags().BoolVarP(&opts.CompactResponse, flag.CompactResponse, flag.CompactResponseShort, false, usage.CompactResponse)
_ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag())

return cmd
Expand Down
8 changes: 7 additions & 1 deletion internal/cli/atlas/processes/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ type ListOpts struct {
cli.GlobalOpts
cli.OutputOpts
cli.ListOpts
store store.ProcessLister
CompactResponse bool
store store.ProcessLister
}

func (opts *ListOpts) initStore(ctx context.Context) func() error {
Expand All @@ -55,6 +56,10 @@ func (opts *ListOpts) Run() error {
return err
}

if opts.CompactResponse {
return opts.PrintForCompactResultsResponse(r)
}

return opts.Print(r)
}

Expand Down Expand Up @@ -100,6 +105,7 @@ func ListBuilder() *cobra.Command {

cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID)
cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut)
cmd.Flags().BoolVarP(&opts.CompactResponse, flag.CompactResponse, flag.CompactResponseShort, false, usage.CompactResponse)
_ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag())

return cmd
Expand Down
8 changes: 7 additions & 1 deletion internal/cli/atlas/projects/apikeys/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ type ListOpts struct {
cli.GlobalOpts
cli.OutputOpts
cli.ListOpts
store store.ProjectAPIKeyLister
CompactResponse bool
store store.ProjectAPIKeyLister
}

func (opts *ListOpts) initStore(ctx context.Context) func() error {
Expand All @@ -54,6 +55,10 @@ func (opts *ListOpts) Run() error {
return err
}

if opts.CompactResponse {
return opts.PrintForCompactResultsResponse(r)
}

return opts.Print(r)
}

Expand Down Expand Up @@ -85,6 +90,7 @@ func ListBuilder() *cobra.Command {

cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID)
cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut)
cmd.Flags().BoolVarP(&opts.CompactResponse, flag.CompactResponse, flag.CompactResponseShort, false, usage.CompactResponse)
_ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag())

return cmd
Expand Down
8 changes: 7 additions & 1 deletion internal/cli/atlas/projects/users/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ type ListOpts struct {
cli.GlobalOpts
cli.OutputOpts
cli.ListOpts
store store.ProjectUsersLister
CompactResponse bool
store store.ProjectUsersLister
}

func (opts *ListOpts) initStore(ctx context.Context) func() error {
Expand All @@ -54,6 +55,10 @@ func (opts *ListOpts) Run() error {
return err
}

if opts.CompactResponse {
return opts.PrintForCompactResultsResponse(r)
}

return opts.Print(r)
}

Expand Down Expand Up @@ -85,6 +90,7 @@ func ListBuilder() *cobra.Command {

cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID)
cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut)
cmd.Flags().BoolVarP(&opts.CompactResponse, flag.CompactResponse, flag.CompactResponseShort, false, usage.CompactResponse)
_ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag())

return cmd
Expand Down
8 changes: 7 additions & 1 deletion internal/cli/atlas/teams/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ type ListOpts struct {
cli.GlobalOpts
cli.OutputOpts
cli.ListOpts
store store.TeamLister
CompactResponse bool
store store.TeamLister
}

func (opts *ListOpts) initStore(ctx context.Context) func() error {
Expand All @@ -54,6 +55,10 @@ func (opts *ListOpts) Run() error {
return err
}

if opts.CompactResponse {
return opts.PrintForCompactResultsResponse(r)
}

return opts.Print(r)
}

Expand Down Expand Up @@ -85,6 +90,7 @@ func ListBuilder() *cobra.Command {

cmd.Flags().StringVar(&opts.OrgID, flag.OrgID, "", usage.OrgID)
cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut)
cmd.Flags().BoolVarP(&opts.CompactResponse, flag.CompactResponse, flag.CompactResponseShort, false, usage.CompactResponse)
_ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag())

return cmd
Expand Down
10 changes: 8 additions & 2 deletions internal/cli/atlas/teams/users/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ const listTemplate = `ID FIRST NAME LAST NAME USERNAME EMAIL{{range .Results}}
type ListOpts struct {
cli.GlobalOpts
cli.OutputOpts
store store.TeamUserLister
teamID string
CompactResponse bool
store store.TeamUserLister
teamID string
}

func (opts *ListOpts) initStore(ctx context.Context) func() error {
Expand All @@ -52,6 +53,10 @@ func (opts *ListOpts) Run() error {
return err
}

if opts.CompactResponse {
return opts.PrintForCompactResultsResponse(r)
}

return opts.Print(r)
}

Expand Down Expand Up @@ -82,6 +87,7 @@ func ListBuilder() *cobra.Command {

cmd.Flags().StringVar(&opts.OrgID, flag.OrgID, "", usage.OrgID)
cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut)
cmd.Flags().BoolVarP(&opts.CompactResponse, flag.CompactResponse, flag.CompactResponseShort, false, usage.CompactResponse)
_ = cmd.RegisterFlagCompletionFunc(flag.Output, opts.AutoCompleteOutputFlag())

_ = cmd.MarkFlagRequired(flag.TeamID)
Expand Down
Loading