27 lines
530 B
Go
27 lines
530 B
Go
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)
|
|
}
|
|
}
|