1. refactor kubesphere dependency service client creation, we can disable dependency by config 2. dependencies can be configured by configuration file 3. refactor cmd package using cobra.Command, so we can use hypersphere to invoke command sepearately. Later we only need to build one image to contains all kubesphere core components. One command to rule them all! 4. live reloading configuration currently not implemented
23 lines
624 B
Go
23 lines
624 B
Go
package term
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/docker/docker/pkg/term"
|
|
"io"
|
|
)
|
|
|
|
// TerminalSize returns the current width and height of the user's terminal. If it isn't a terminal,
|
|
// nil is returned. On error, zero values are returned for width and height.
|
|
// Usually w must be the stdout of the process. Stderr won't work.
|
|
func TerminalSize(w io.Writer) (int, int, error) {
|
|
outFd, isTerminal := term.GetFdInfo(w)
|
|
if !isTerminal {
|
|
return 0, 0, fmt.Errorf("given writer is no terminal")
|
|
}
|
|
winsize, err := term.GetWinsize(outFd)
|
|
if err != nil {
|
|
return 0, 0, err
|
|
}
|
|
return int(winsize.Width), int(winsize.Height), nil
|
|
}
|