[agent] - bastion mode init

This commit is contained in:
zeaslity
2024-04-17 11:50:13 +08:00
parent f20d5e549c
commit d54ebfc7b0
2 changed files with 29 additions and 5 deletions

View File

@@ -0,0 +1,26 @@
package bastion_init
import (
"fmt"
"io"
"os"
)
// getStandardOutPutLength 获取到标准输出终端的长度
func getStandardOutPutLength() (int, error) {
buffer := make([]byte, 0)
_, err := io.ReadFull(os.Stdout, buffer)
if err != nil {
return 0, err
}
return len(buffer), nil
}
func PrintBastionHelp() {
length, err := getStandardOutPutLength()
if err == nil {
fmt.Printf("标准输出终端的长度: %d 字节\n", length)
} else {
fmt.Println("获取标准输出终端长度时发生错误:", err)
}
}