Merge pull request #768 from huanggze/log-download

feat: allow to export logs
This commit is contained in:
KubeSphere CI Bot
2019-09-25 15:57:55 +08:00
committed by GitHub
11 changed files with 346 additions and 257 deletions

View File

@@ -14,12 +14,17 @@ limitations under the License.
package stringutils
import (
"regexp"
"strings"
"unicode/utf8"
"github.com/asaskevich/govalidator"
)
const ansi = "[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
var re = regexp.MustCompile(ansi)
// Creates an slice of slice values not included in the other given slice.
func Diff(base, exclude []string) (result []string) {
excludeMap := make(map[string]bool)
@@ -83,3 +88,7 @@ func Split(str string, sep string) []string {
}
return strings.Split(str, sep)
}
func StripAnsi(str string) string {
return re.ReplaceAllString(str, "")
}