Skip to content
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

Remove default value info for true flag in delete command #2006

Merged
merged 1 commit into from
May 2, 2023

Conversation

pratap0007
Copy link
Contributor

@pratap0007 pratap0007 commented Apr 25, 2023

This patch removes default value info of flag as default value of flag is true and default value info will be added by default

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

Release Notes

This will remove default value info of flag in delete command as default value info will be added by default in case of true flag

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Apr 25, 2023
@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 25, 2023
Copy link
Member

@jkandasa jkandasa left a comment

Choose a reason for hiding this comment

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

@pratap0007 thanks for the PR, I see the same duplication in different places. Can you please update those occurrences too?

$ grep -r "(default: " pkg/
pkg/flags/flags.go:		"kubectl config file (default: $HOME/.kube/config)")
pkg/flags/flags.go:		"name of the kubeconfig context to use (default: kubectl config current-context)")
pkg/flags/flags.go:		"namespace to use (default: from $KUBECONFIG)")
pkg/flags/flags.go:		"disable colouring (default: false)")
pkg/flags/flags.go:		"disable coloring (default: false)")
pkg/cmd/clustertask/delete.go:	c.Flags().BoolVarP(&opts.ForceDelete, "force", "f", false, "Whether to force deletion (default: false)")
pkg/cmd/clustertask/delete.go:	c.Flags().BoolVarP(&opts.DeleteAll, "all", "", false, "Delete all ClusterTasks (default: false)")
pkg/cmd/clustertask/delete.go:	c.Flags().BoolVarP(&opts.DeleteRelated, "trs", "", false, "Whether to delete ClusterTask(s) and related resources (TaskRuns) (default: false)")
pkg/cmd/pipeline/delete.go:	c.Flags().BoolVarP(&opts.ForceDelete, "force", "f", false, "Whether to force deletion (default: false)")
pkg/cmd/pipeline/delete.go:	c.Flags().BoolVarP(&opts.DeleteRelated, "prs", "", false, "Whether to delete Pipeline(s) and related resources (PipelineRuns) (default: false)")
pkg/cmd/pipeline/delete.go:	c.Flags().BoolVarP(&opts.DeleteAllNs, "all", "", false, "Delete all Pipelines in a namespace (default: false)")
pkg/cmd/eventlistener/delete.go:	c.Flags().BoolVarP(&opts.ForceDelete, "force", "f", false, "Whether to force deletion (default: false)")
pkg/cmd/eventlistener/delete.go:	c.Flags().BoolVarP(&opts.DeleteAllNs, "all", "", false, "Delete all EventListeners in a namespace (default: false)")
pkg/cmd/taskrun/delete.go:	c.Flags().BoolVarP(&opts.ForceDelete, "force", "f", false, "Whether to force deletion (default: false)")
pkg/cmd/taskrun/delete.go:	c.Flags().BoolVarP(&opts.DeleteAllNs, "all", "", false, "Delete all TaskRuns in a namespace (default: false)")
pkg/cmd/taskrun/delete.go:	c.Flags().BoolVarP(&opts.IgnoreRunning, "ignore-running", "i", true, "ignore running TaskRun (default: true)")
pkg/cmd/taskrun/delete.go:	c.Flags().BoolVarP(&opts.IgnoreRunningPipelinerun, "ignore-running-pipelinerun", "", true, "ignore deleting taskruns of a running PipelineRun (default: true)")
pkg/cmd/taskrun/list.go:	c.Flags().IntVarP(&opts.Limit, "limit", "", 0, "limit TaskRuns listed (default: return all TaskRuns)")
pkg/cmd/task/delete.go:	c.Flags().BoolVarP(&opts.ForceDelete, "force", "f", false, "Whether to force deletion (default: false)")
pkg/cmd/task/delete.go:	c.Flags().BoolVarP(&opts.DeleteRelated, "trs", "", false, "Whether to delete Task(s) and related resources (TaskRuns) (default: false)")
pkg/cmd/task/delete.go:	c.Flags().BoolVarP(&opts.DeleteAllNs, "all", "", false, "Delete all Tasks in a namespace (default: false)")
pkg/cmd/triggertemplate/delete.go:	c.Flags().BoolVarP(&opts.ForceDelete, "force", "f", false, "Whether to force deletion (default: false)")
pkg/cmd/triggertemplate/delete.go:	c.Flags().BoolVarP(&opts.DeleteAllNs, "all", "", false, "Delete all TriggerTemplates in a namespace (default: false)")
pkg/cmd/triggerbinding/delete.go:	c.Flags().BoolVarP(&opts.ForceDelete, "force", "f", false, "Whether to force deletion (default: false)")
pkg/cmd/triggerbinding/delete.go:	c.Flags().BoolVarP(&opts.DeleteAllNs, "all", "", false, "Delete all TriggerBindings in a namespace (default: false)")
pkg/cmd/clustertriggerbinding/delete.go:	c.Flags().BoolVarP(&opts.ForceDelete, "force", "f", false, "Whether to force deletion (default: false)")
pkg/cmd/clustertriggerbinding/delete.go:	c.Flags().BoolVarP(&opts.DeleteAll, "all", "", false, "Delete all ClusterTriggerBindings (default: false)")
pkg/cmd/pipelinerun/delete.go:	c.Flags().BoolVarP(&opts.ForceDelete, "force", "f", false, "Whether to force deletion (default: false)")
pkg/cmd/pipelinerun/delete.go:	c.Flags().BoolVarP(&opts.IgnoreRunning, "ignore-running", "i", true, "ignore running PipelineRun (default: true)")
pkg/cmd/pipelinerun/delete.go:	c.Flags().BoolVarP(&opts.DeleteAllNs, "all", "", false, "Delete all PipelineRuns in a namespace (default: false)")
pkg/cmd/pipelinerun/list.go:	c.Flags().IntVarP(&opts.Limit, "limit", "", 0, "limit PipelineRuns listed (default: return all PipelineRuns)")

For limit flags we may update the string something like,
c.Flags().IntVarP(&opts.Limit, "limit", "", 0, "limit PipelineRuns listed (default: return all PipelineRuns)

=> c.Flags().IntVarP(&opts.Limit, "limit", "", 0, "Limits the number of PipelineRuns. If the limit value is 0 returns all

This patch removes default value info of flag as default value
of flag is true and default value info will be added by default

Signed-off-by: Shiv Verma <shverma@redhat.com>
@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 25, 2023
@pratap0007
Copy link
Contributor Author

@jkandasa Thank you and have updated the PR

@jkandasa
Copy link
Member

@jkandasa Thank you and have updated the PR

Thanks for the quick response @pratap0007
Can you please update all occurrences?

$ grep -r "(default:" pkg/

@pratap0007
Copy link
Contributor Author

@jkandasa Thank you and have updated the PR

Thanks for the quick response @pratap0007 Can you please update all occurrences?

$ grep -r "(default:" pkg/

The generated docs will show default value only if it is true.It doesn't show if it is something else that's why I have removed default value only in case of true to remove duplication

@pratap0007
Copy link
Contributor Author

/test pull-tekton-cli-integration-tests

Copy link
Member

@jkandasa jkandasa left a comment

Choose a reason for hiding this comment

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

@pratap0007 I thought github.com/spf13/cobra generates default values for false too. But it seems not.

LGTM

@piyush-garg
Copy link
Contributor

/approve
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label May 2, 2023
@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jkandasa, piyush-garg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 2, 2023
@tekton-robot tekton-robot merged commit 008ddd5 into tektoncd:main May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants