Skip to content

Commit f19edc7

Browse files
fix: Update welcome message and command validation (#156)
- Changed the check from the existence of the .codacy directory to the codacy.yaml file. - Updated the welcome message to provide clearer instructions for initializing with a Codacy account. - Added "update" command to the list of commands that can skip validation. - Improved overall clarity and user guidance in the CLI output.
1 parent 86a2cb2 commit f19edc7

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

cmd/root.go

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ var rootCmd = &cobra.Command{
5050
}
5151
},
5252
Run: func(cmd *cobra.Command, args []string) {
53-
// Check if .codacy directory exists
54-
if _, err := os.Stat(".codacy"); os.IsNotExist(err) {
55-
// Show welcome message if .codacy doesn't exist
53+
// Check if codacy.yaml exists
54+
if _, err := os.Stat(config.Config.ProjectConfigFile()); os.IsNotExist(err) {
55+
// Show welcome message if codacy.yaml doesn't exist
5656
showWelcomeMessage()
5757
return
5858
}
5959

60-
// If .codacy exists, show regular help
60+
// If codacy.yaml exists, show regular help
6161
cmd.Help()
6262
},
6363
}
@@ -72,25 +72,23 @@ func Execute() {
7272
func showWelcomeMessage() {
7373
bold := color.New(color.Bold)
7474
cyan := color.New(color.FgCyan)
75-
yellow := color.New(color.FgYellow)
7675

7776
fmt.Println()
7877
bold.Println("👋 Welcome to Codacy CLI!")
7978
fmt.Println()
8079
fmt.Println("This tool helps you analyze and maintain code quality in your projects.")
8180
fmt.Println()
82-
yellow.Println("To get started, you'll need a Codacy API token.")
83-
fmt.Println("You can find your Project API token in Codacy under:")
84-
fmt.Println("Project > Settings > Integrations > Repository API tokens")
81+
cyan.Println("Get started initializing with your Codacy account:")
82+
fmt.Println(" codacy-cli init --api-token <token> --provider <gh|gl|bb> --organization <org> --repository <repo>")
8583
fmt.Println()
86-
cyan.Println("Initialize your project with:")
87-
fmt.Println(" codacy-cli init --repository-token YOUR_TOKEN")
88-
fmt.Println(" codacy-cli init --codacy-api-token YOUR_TOKEN")
84+
fmt.Println("ℹ️ This will synchronzize tools and paterns from Codacy to your local machine.")
85+
fmt.Println(" You can find your Project API token in Codacy under:")
86+
fmt.Println(" Project > Settings > Integrations > Repository API tokens")
8987
fmt.Println()
90-
fmt.Println("Or run without a token to use local configuration:")
88+
fmt.Println("Or initialize with default Codacy configuration:")
9189
fmt.Println(" codacy-cli init")
9290
fmt.Println()
93-
fmt.Println("For more information about available commands, run:")
91+
fmt.Println("For more information, run:")
9492
fmt.Println(" codacy-cli --help")
9593
}
9694

cmd/validation.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ func shouldSkipValidation(cmdName string) bool {
8282
"version",
8383
"reset", // config reset should work even with empty/invalid codacy.yaml
8484
"codacy-cli", // root command when called without subcommands
85+
"update",
8586
}
8687

8788
for _, skipCmd := range skipCommands {

0 commit comments

Comments
 (0)