Refactor codebase with improved structure and logging

- Restructured info.go with extracted helper functions for better readability
- Enhanced updateassets.go with cleaner asset processing logic and better error handling
- Improved client.go formatting and logging consistency
- Added logs.go for centralized logging functionality
- Updated dependencies in go.mod to include tint as direct dependency
- Cleaned up README.md with simplified installation instructions and structure
- Added comprehensive assets/ directory with build configuration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Felipe M 2025-07-14 17:14:12 +02:00
parent c01c9c2843
commit 71a7b0de11
No known key found for this signature in database
GPG key ID: 52E5D65FCF99808A
18 changed files with 852 additions and 105 deletions

46
info.go
View file

@ -19,30 +19,44 @@ func InfoCommand() error {
// PrintPluginInfo displays formatted plugin information.
func PrintPluginInfo(manifest *model.Manifest) error {
printBasicInfo(manifest)
printCodeComponents(manifest)
printSettingsSchema(manifest)
return nil
}
// printBasicInfo prints basic plugin information.
func printBasicInfo(manifest *model.Manifest) {
Logger.Info("Plugin Information:")
Logger.Info("==================")
// Basic plugin info
Logger.Info("ID:", "value", manifest.Id)
Logger.Info("Name:", "value", manifest.Name)
Logger.Info("Version:", "value", manifest.Version)
// Minimum Mattermost version
if manifest.MinServerVersion != "" {
Logger.Info("Min MM Version:", "value", manifest.MinServerVersion)
} else {
Logger.Info("Min MM Version:", "value", "Not specified")
minVersion := manifest.MinServerVersion
if minVersion == "" {
minVersion = "Not specified"
}
Logger.Info("Min MM Version:", "value", minVersion)
// Description if available
if manifest.Description != "" {
Logger.Info("Description:", "value", manifest.Description)
}
}
// printCodeComponents prints information about server and webapp code.
func printCodeComponents(manifest *model.Manifest) {
Logger.Info("Code Components:")
Logger.Info("================")
// Server code presence
printServerCodeInfo(manifest)
printWebappCodeInfo(manifest)
}
// printServerCodeInfo prints server code information.
func printServerCodeInfo(manifest *model.Manifest) {
if HasServerCode(manifest) {
Logger.Info("Server Code:", "value", "Yes")
if manifest.Server != nil && len(manifest.Server.Executables) > 0 {
@ -55,8 +69,10 @@ func PrintPluginInfo(manifest *model.Manifest) error {
} else {
Logger.Info("Server Code:", "value", "No")
}
}
// Webapp code presence
// printWebappCodeInfo prints webapp code information.
func printWebappCodeInfo(manifest *model.Manifest) {
if HasWebappCode(manifest) {
Logger.Info("Webapp Code:", "value", "Yes")
if manifest.Webapp != nil && manifest.Webapp.BundlePath != "" {
@ -65,15 +81,15 @@ func PrintPluginInfo(manifest *model.Manifest) error {
} else {
Logger.Info("Webapp Code:", "value", "No")
}
}
// Settings schema
// printSettingsSchema prints settings schema information.
func printSettingsSchema(manifest *model.Manifest) {
value := "No"
if manifest.SettingsSchema != nil {
Logger.Info("Settings Schema:", "value", "Yes")
} else {
Logger.Info("Settings Schema:", "value", "No")
value = "Yes"
}
return nil
Logger.Info("Settings Schema:", "value", value)
}
// InfoCommandWithPath implements the 'info' command with a custom path.