@@ -39,7 +39,7 @@ import (
3939
4040// Global constants for UI and Versioning
4141const (
42- CC_VERSION = "2.5"
42+ CC_VERSION = "2.5.1 "
4343 COLS = 62
4444 LINES = 32
4545 GOOS = runtime .GOOS
@@ -67,7 +67,7 @@ type Program struct {
6767
6868// ========================= HELPER FUNCTIONS =========================
6969
70- // initApp prepares the terminal environment (Title, Resize)
70+ // initApp prepares the terminal environment (Title, Resize, User Info )
7171func initApp () {
7272 fmt .Printf ("Initializing CrunchyCleaner %s...\n " , CC_VERSION )
7373
@@ -82,18 +82,12 @@ func initApp() {
8282 fmt .Sscanf (strings .TrimSpace (string (out )), "%d %d" , & origCols , & origLines )
8383
8484 } else {
85- cmd := exec .Command ("stty size < /dev/tty" )
85+ cmd := exec .Command ("sh" , "-c" , " stty size < /dev/tty" )
8686
8787 out , _ := cmd .Output ()
8888 fmt .Sscanf (strings .TrimSpace (string (out )), "%d %d" , & origLines , & origCols )
8989 }
9090
91- // Set Terminal Title via ANSI sequence
92- fmt .Printf ("\033 ]0;CrunchyCleaner %s\007 " , CC_VERSION )
93-
94- // Resize terminal
95- terminalresize (COLS , LINES )
96-
9791 // Clear screen
9892 if GOOS == "windows" {
9993 // Windows CMD requires an external call to 'cls'
@@ -108,6 +102,12 @@ func initApp() {
108102 }
109103 // Fallback use ANSI escape sequences
110104 fmt .Print ("\033 [H\033 [2J" )
105+
106+ // Set Terminal Title via ANSI sequence
107+ fmt .Printf ("\033 ]0;CrunchyCleaner %s\007 " , CC_VERSION )
108+ // Resize terminal
109+ terminalresize (COLS , LINES )
110+ time .Sleep (1 * time .Second )
111111}
112112
113113// cc_exit provides a clean termination of the application
@@ -162,10 +162,10 @@ func terminalresize(w int, h int) {
162162 if GOOS == "windows" {
163163 psCmd := fmt .Sprintf (
164164 `$w=(Get-Host).UI.RawUI;
165- $newSize=New-Object System.Management.Automation.Host.Size(%d,%d);
166- $newBuffer=New-Object System.Management.Automation.Host.Size(%d,999);
167- $w.BufferSize=$newBuffer;
168- $w.WindowSize=$newSize` ,
165+ $newSize=New-Object System.Management.Automation.Host.Size(%d,%d);
166+ $newBuffer=New-Object System.Management.Automation.Host.Size(%d,999);
167+ $w.BufferSize=$newBuffer;
168+ $w.WindowSize=$newSize` ,
169169 w , h , w ,
170170 )
171171 exec .Command ("powershell" , "-NoProfile" , "-Command" , psCmd ).Run ()
0 commit comments