This is a huge commit, it does following things:
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
This commit is contained in:
22
pkg/utils/term/term.go
Normal file
22
pkg/utils/term/term.go
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user