Includes mmctl into the mono-repo (#23091)

* Includes mmctl into the mono-repo

* Update to use the new public module paths

* Adds docs check to the mmctl CI

* Fix public utils import path

* Tidy up modules

* Fix linter

* Update CI tasks to use the new file structure

* Update CI references
Этот коммит содержится в:
Miguel de la Cruz
2023-06-05 12:42:55 +02:00
коммит произвёл GitHub
родитель 412109b02e
Коммит 951456c780
305 изменённых файлов: 47027 добавлений и 88 удалений

38
server/cmd/mmctl/printer/util.go Обычный файл
Просмотреть файл

@@ -0,0 +1,38 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package printer
import (
"bytes"
"errors"
"os"
"golang.org/x/term"
)
func checkInteractiveTerminal() error {
fileInfo, err := os.Stdout.Stat()
if err != nil {
return err
}
if (fileInfo.Mode() & os.ModeCharDevice) == 0 {
return errors.New("this is not an interactive shell")
}
return nil
}
func termHeight(file *os.File) (int, error) {
_, h, err := term.GetSize(int(file.Fd()))
if err != nil {
return -1, err
}
return h, nil
}
func lineCount(b []byte) int {
return bytes.Count(b, []byte{'\n'})
}