Skip to content

Conversation

@onasser1
Copy link
Contributor

Related #19867

Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
@onasser1 onasser1 requested review from a team as code owners October 25, 2025 15:34
@bunnyshell
Copy link

bunnyshell bot commented Oct 25, 2025

🔴 Preview Environment stopped on Bunnyshell

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🔵 /bns:start to start the environment
  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment
@onasser1
Copy link
Contributor Author

/component cli

Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
# Switch Argo CD context
argocd context cd.argoproj.io
argocd context switch cd.argoproj.io
Copy link
Member

Choose a reason for hiding this comment

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

how about argocd context use?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I'm not wrong, the switch command does exactly the same as use command, do you mean to change the name of the command from switch to be use?
If this is not what you mean, can you tell me the difference between them?

err := deleteContext(args[0], clientOpts.ConfigPath)
errors.CheckError(err)
return
func NewContextListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
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
func NewContextListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
// NewContextListCommand lists the contexts
func NewContextListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you think we should to stick to the function comments format in app and login (i.e. https://github.com/argoproj/argo-cd/blob/master/cmd/argocd/commands/app.go#L124)
or apply your change and make the comment more meaningful (Anyway I see that the usage of that commands make it clear anyway) but I'd wait for your answer

Copy link
Member

@nitishfy nitishfy left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. The code looks good to me. Here are few suggestions:

  1. Please write comments in the code wherever required, eg. in the code for switch command.
  2. Write unit tests for the utility functions.
  3. You'll be required to run codegen to update the docs too.
@nitishfy nitishfy changed the title feat: Add context login CLI sub command Oct 27, 2025
return false
}

func (l *LocalConfig) GetContext(ctxName string) (*ContextRef, error) {
Copy link
Member

Choose a reason for hiding this comment

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

please write unit tests.

Co-authored-by: Nitish Kumar <justnitish06@gmail.com>
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

❌ Patch coverage is 49.42529% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.30%. Comparing base (b260143) to head (e3b7c18).
⚠️ Report is 68 commits behind head on master.

Files with missing lines Patch % Lines
cmd/argocd/commands/context.go 50.00% 34 Missing and 4 partials ⚠️
util/localconfig/localconfig.go 45.45% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #25077      +/-   ##
==========================================
+ Coverage   60.83%   62.30%   +1.46%     
==========================================
  Files         350      351       +1     
  Lines       60430    49281   -11149     
==========================================
- Hits        36762    30703    -6059     
+ Misses      20754    15653    -5101     
- Partials     2914     2925      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
@onasser1 onasser1 requested a review from nitishfy October 29, 2025 11:53
@onasser1 onasser1 force-pushed the feat/add-context-login-subcommand branch from 3580699 to 9c1e965 Compare October 29, 2025 14:00
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>

Provide use command as alias for switch

Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants