-
Notifications
You must be signed in to change notification settings - Fork 10
Feature/improve ux #50
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
Changes from all commits
e0681d3
43d9262
89c81c3
8724a50
1749745
8aed5d8
d99271c
9a9d488
9b11b2b
359d205
bebd563
a3efa99
7ecc4f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,5 +4,5 @@ runtimes: | |
| tools: | ||
| - [email protected] | ||
| - [email protected] | ||
| - [email protected] | ||
| - [email protected] | ||
| - [email protected] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,14 +4,24 @@ import ( | |
| "fmt" | ||
| "os" | ||
|
|
||
| "github.com/fatih/color" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| var rootCmd = &cobra.Command{ | ||
| Use: "codacy-cli", | ||
| Short: "Codacy CLI", | ||
| Long: "Code analysis", | ||
| Short: "Codacy CLI - A command line interface for Codacy", | ||
| Long: ``, | ||
| Run: func(cmd *cobra.Command, args []string) { | ||
| // Check if .codacy directory exists | ||
| if _, err := os.Stat(".codacy"); os.IsNotExist(err) { | ||
| // Show welcome message if .codacy doesn't exist | ||
| showWelcomeMessage() | ||
| return | ||
| } | ||
|
|
||
| // If .codacy exists, show regular help | ||
| cmd.Help() | ||
| }, | ||
| } | ||
|
|
||
|
|
@@ -21,3 +31,24 @@ func Execute() { | |
| os.Exit(1) | ||
| } | ||
| } | ||
|
|
||
| func showWelcomeMessage() { | ||
| bold := color.New(color.Bold) | ||
| cyan := color.New(color.FgCyan) | ||
| yellow := color.New(color.FgYellow) | ||
|
|
||
| fmt.Println() | ||
| bold.Println("π Welcome to Codacy CLI!") | ||
| fmt.Println() | ||
| fmt.Println("This tool helps you analyze and maintain code quality in your projects.") | ||
| fmt.Println() | ||
| yellow.Println("To get started, you'll need a Codacy API token.") | ||
| fmt.Println("You can find your Project API token in Codacy under:") | ||
| fmt.Println("Project > Settings > Integrations > Repository API tokens") | ||
|
Comment on lines
+45
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should use API token instead of Codacy API token. And then also expose the possibility of doing it with account API tokens as well, and specifying the URL directly. This variant would be faster and more user friendly. To my understanding, it works with both types of API tokens, right?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I also was thinking just go with "general" API token, not the project one. Anyway this will be resolved in another PR - this one is more UI specfifc - there is another Task for making setup flow easier
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sorry what? π Now it works with repository-token, and you are talking about the Account API token correct? Yeah, if it is a requirement for the MCP, we can add a task to add support for it (but agree that is out of scope of this PR)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created https://codacy.atlassian.net/browse/PLUTO-1379 for the follow up, please take a look @andrzej-janczak @manufacturist |
||
| fmt.Println() | ||
| cyan.Println("Initialize your project with:") | ||
| fmt.Println(" codacy-cli init --repository-token YOUR_TOKEN") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The thing missing is not just the |
||
| fmt.Println() | ||
| fmt.Println("Or run without a token to use local configuration:") | ||
| fmt.Println(" codacy-cli init") | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what? An empty line or?