Files
ProjectOctopus/agent-wdd/utils/PrintUtils.go
zeaslity 5c39bd7594 Enhance Docker Installation and Management Commands
- Improved Docker installation process for Ubuntu systems
- Added support for dynamic Docker version detection
- Enhanced Docker local and online installation commands
- Implemented more robust Docker removal functionality
- Updated Docker installation to use system-specific package sources
- Added better error handling and logging for Docker operations
- Refined Docker service startup and configuration checks
2025-02-28 17:45:12 +08:00

56 lines
1.1 KiB
Go

package utils
import (
"agent-wdd/log"
"encoding/json"
"fmt"
)
func BeautifulPrint(object interface{}) {
bytes, err := json.MarshalIndent(object, "", " ")
if err != nil {
log.Error("[BeautifulPrint] - json marshal error ! => %v", object)
}
fmt.Println()
fmt.Println(string(bytes))
fmt.Println()
}
func BeautifulPrintToString(object interface{}) string {
bytes, err := json.MarshalIndent(object, "", " ")
if err != nil {
log.Error("[BeautifulPrint] - json marshal error ! => %v", object)
}
return string(bytes)
}
func BeautifulPrintWithTitle(contend any, title string) {
fmt.Println()
fmt.Println(fmt.Sprintf("content tile is => %s", title))
bytes, _ := json.MarshalIndent(contend, "", " ")
fmt.Println(string(bytes))
fmt.Println("---------- end -----------")
}
func BeautifulPrintListWithTitle(contend []string, title string) {
fmt.Println()
fmt.Println(">>>>>>>> " + title + " <<<<<<<<")
for _, line := range contend {
fmt.Println(line)
}
fmt.Println("---------- end -----------")
}
func SplitLinePrint() {
fmt.Println()
fmt.Println()
fmt.Println()
}