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
24 changes: 11 additions & 13 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ var rootCmd = &cobra.Command{
}
},
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
// Check if codacy.yaml exists
if _, err := os.Stat(config.Config.ProjectConfigFile()); os.IsNotExist(err) {
// Show welcome message if codacy.yaml doesn't exist
showWelcomeMessage()
return
}

// If .codacy exists, show regular help
// If codacy.yaml exists, show regular help
cmd.Help()
},
}
Expand All @@ -72,25 +72,23 @@ func Execute() {
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")
cyan.Println("Get started initializing with your Codacy account:")
fmt.Println(" codacy-cli init --api-token <token> --provider <gh|gl|bb> --organization <org> --repository <repo>")
fmt.Println()
cyan.Println("Initialize your project with:")
fmt.Println(" codacy-cli init --repository-token YOUR_TOKEN")
fmt.Println(" codacy-cli init --codacy-api-token YOUR_TOKEN")
fmt.Println("ℹ️ This will synchronzize tools and paterns from Codacy to your local machine.")
fmt.Println(" You can find your Project API token in Codacy under:")
fmt.Println(" Project > Settings > Integrations > Repository API tokens")
fmt.Println()
fmt.Println("Or run without a token to use local configuration:")
fmt.Println("Or initialize with default Codacy configuration:")
fmt.Println(" codacy-cli init")
fmt.Println()
fmt.Println("For more information about available commands, run:")
fmt.Println("For more information, run:")
fmt.Println(" codacy-cli --help")
}

Expand Down
1 change: 1 addition & 0 deletions cmd/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func shouldSkipValidation(cmdName string) bool {
"version",
"reset", // config reset should work even with empty/invalid codacy.yaml
"codacy-cli", // root command when called without subcommands
"update",
}

for _, skipCmd := range skipCommands {
Expand Down