Merge branch 'logs'
+ Added better namespace handling when > 9 namespaces + Added fail fast panic if k8s config is toast + Added new command line args and sub commands + Revamped logs to show more info + Added filtering ability on list views + And Mo bug fixes (hopefully)... + Changed log location file to golang temp dir + Added K9s config file to persist defaultsmine
commit
3ff2f64255
20
README.md
20
README.md
|
|
@ -33,6 +33,26 @@ brew tap derailed/k9s && brew install k9s
|
|||
|
||||
<br/>
|
||||
|
||||
---
|
||||
## Command Line Options
|
||||
|
||||
* --namespace(-n) change the default namespace
|
||||
* --refresh(-r) changes the default(2sec) refresh
|
||||
|
||||
<br/>
|
||||
|
||||
---
|
||||
## PreFlight
|
||||
|
||||
* K9s uses 256 colors terminal mode. On OSX make sure TERM is set accordingly.
|
||||
|
||||
```shell
|
||||
export TERM=xterm-256color
|
||||
```
|
||||
|
||||
---
|
||||
<br/>
|
||||
|
||||
---
|
||||
## Commands
|
||||
|
||||
|
|
|
|||
BIN
assets/k9s.png
BIN
assets/k9s.png
Binary file not shown.
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 65 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 410 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 330 KiB |
|
|
@ -0,0 +1,16 @@
|
|||
# Release v0.1.1
|
||||
|
||||
## Change Logs
|
||||
|
||||
+ Added config file to tracks K9s configs
|
||||
+ Changed namespace management to track top 5 most recent namespaces.
|
||||
+ Changed keyboard naviation on log view
|
||||
+ Added log buffer to default to the last 200 lines (settable in config file)
|
||||
+ Added fail early countermeasures.
|
||||
+ Added info sub-command to show K9s general info
|
||||
+ Added log level setting on CLI
|
||||
+ Changed help command to just ? and back to escape
|
||||
|
||||
## Bugs
|
||||
|
||||
+
|
||||
61
cmd/root.go
61
cmd/root.go
|
|
@ -2,42 +2,67 @@ package cmd
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gdamore/tcell"
|
||||
"strings"
|
||||
|
||||
"github.com/derailed/k9s/views"
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/k8sland/tview"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
const defaultRefreshRate = 5 // secs
|
||||
const (
|
||||
defaultRefreshRate = 2 // secs
|
||||
defaultLogLevel = "info"
|
||||
defaultNamespace = ""
|
||||
)
|
||||
|
||||
var (
|
||||
version = "dev"
|
||||
commit = "dev"
|
||||
date = "n/a"
|
||||
refreshRate int
|
||||
logLevel string
|
||||
namespace string
|
||||
kubeconfig string
|
||||
|
||||
rootCmd = &cobra.Command{
|
||||
Use: "k9s",
|
||||
Short: "A graphical CLI for your Kubernetes cluster management.",
|
||||
Long: `k9s is a Kubernetes CLI to view and manage your Kubernetes clusters.`,
|
||||
Long: `K9s is a Kubernetes CLI to view and manage your Kubernetes clusters.`,
|
||||
Run: run,
|
||||
}
|
||||
versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print k9s version",
|
||||
Long: "Prints k9s version",
|
||||
Short: "Print k9s version info",
|
||||
Long: "Prints k9s version info",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Printf("Version:%s GitCommit:%s On %s\n", version, commit, date)
|
||||
},
|
||||
}
|
||||
infoCmd = &cobra.Command{
|
||||
Use: "info",
|
||||
Short: "Print k9s configuration information",
|
||||
Long: "Print k9s configuration information",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
const (
|
||||
cyan = "\033[1;36m%s\033[0m"
|
||||
green = "\033[1;32m%s\033[0m"
|
||||
magenta = "\033[1;35m%s\033[0m"
|
||||
)
|
||||
fmt.Printf(cyan+"\n", strings.Repeat("-", 80))
|
||||
fmt.Printf(green+"\n", "🐶 K9s Information")
|
||||
fmt.Printf(magenta, fmt.Sprintf("%-10s", "LogFile:"))
|
||||
fmt.Printf("%s\n", views.K9sLogs)
|
||||
fmt.Printf(magenta, fmt.Sprintf("%-10s", "Config:"))
|
||||
fmt.Printf("%s\n", views.K9sConfig)
|
||||
fmt.Printf(cyan+"\n", strings.Repeat("-", 80))
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
rootCmd.AddCommand(versionCmd, infoCmd)
|
||||
|
||||
rootCmd.Flags().IntVarP(
|
||||
&refreshRate,
|
||||
|
|
@ -49,9 +74,16 @@ func init() {
|
|||
rootCmd.Flags().StringVarP(
|
||||
&namespace,
|
||||
"namespace", "n",
|
||||
"",
|
||||
defaultNamespace,
|
||||
"Uses a given namespace versus all-namespaces",
|
||||
)
|
||||
|
||||
rootCmd.Flags().StringVarP(
|
||||
&logLevel,
|
||||
"logLevel", "l",
|
||||
defaultLogLevel,
|
||||
"Specify a log level (info, warn, debug, error, fatal, panic, trace)",
|
||||
)
|
||||
}
|
||||
|
||||
// Execute root command
|
||||
|
|
@ -62,12 +94,21 @@ func Execute() {
|
|||
}
|
||||
|
||||
func run(cmd *cobra.Command, args []string) {
|
||||
level, err := log.ParseLevel(logLevel)
|
||||
if err != nil {
|
||||
level = log.DebugLevel
|
||||
}
|
||||
log.SetLevel(level)
|
||||
log.SetFormatter(&log.TextFormatter{FullTimestamp: true, ForceColors: true})
|
||||
|
||||
initStyles()
|
||||
initKeys()
|
||||
|
||||
app := views.NewApp(version, refreshRate, namespace)
|
||||
app.Init()
|
||||
app.Run()
|
||||
{
|
||||
app.Init()
|
||||
app.Run()
|
||||
}
|
||||
}
|
||||
|
||||
func initKeys() {
|
||||
|
|
|
|||
18
go.mod
18
go.mod
|
|
@ -1,55 +1,45 @@
|
|||
module github.com/derailed/k9s
|
||||
|
||||
// replace github.com/k8sland/tview => /Users/fernand/k8sland/src/github.com/k8sland/tview
|
||||
replace github.com/k8sland/tview => /Users/fernand/go_wk/k8sland/src/github.com/k8sland/tview
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.34.0 // indirect
|
||||
github.com/emicklei/go-restful v2.8.1+incompatible // indirect
|
||||
github.com/evanphx/json-patch v4.1.0+incompatible // indirect
|
||||
github.com/gdamore/encoding v1.0.0 // indirect
|
||||
github.com/gdamore/tcell v1.1.0
|
||||
github.com/ghodss/yaml v1.0.0 // indirect
|
||||
github.com/go-openapi/spec v0.18.0 // indirect
|
||||
github.com/gogo/protobuf v1.1.1 // indirect
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c // indirect
|
||||
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf // indirect
|
||||
github.com/googleapis/gnostic v0.2.0 // indirect
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
|
||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
|
||||
github.com/imdario/mergo v0.3.6 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.5 // indirect
|
||||
github.com/jtolds/gls v4.2.1+incompatible // indirect
|
||||
github.com/k8sland/tview v0.1.0
|
||||
github.com/mattn/go-runewidth v0.0.4 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.1 // indirect
|
||||
github.com/onsi/gomega v1.4.3 // indirect
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
|
||||
github.com/petergtz/pegomock v0.0.0-20181206220228-b113d17a7e81
|
||||
github.com/pkg/errors v0.8.1 // indirect
|
||||
github.com/sirupsen/logrus v1.2.0
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
|
||||
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c // indirect
|
||||
github.com/spf13/cobra v0.0.3
|
||||
github.com/spf13/pflag v1.0.3 // indirect
|
||||
github.com/stretchr/testify v1.2.2
|
||||
golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd // indirect
|
||||
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc // indirect
|
||||
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20181105165119-ca4130e427c7 // indirect
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f // indirect
|
||||
golang.org/x/sys v0.0.0-20181031143558-9b800f95dbbc // indirect
|
||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 // indirect
|
||||
google.golang.org/appengine v1.3.0 // indirect
|
||||
gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.1
|
||||
k8s.io/api v0.0.0-20181102122915-de5c567eef5c
|
||||
k8s.io/apiextensions-apiserver v0.0.0-20181206111255-bb0a52a3f19d // indirect
|
||||
k8s.io/apimachinery v0.0.0-20181108045954-261df694e725
|
||||
k8s.io/client-go v9.0.0+incompatible
|
||||
k8s.io/kube-openapi v0.0.0-20190131215449-d8b685cd2daa // indirect
|
||||
k8s.io/kubernetes v1.13.0
|
||||
k8s.io/metrics v0.0.0-20181121073115-d8618695b08f
|
||||
sigs.k8s.io/kind v0.0.0-20190131032353-9307ec01e70f // indirect
|
||||
sigs.k8s.io/kustomize v1.0.11 // indirect
|
||||
)
|
||||
|
|
|
|||
39
go.sum
39
go.sum
|
|
@ -1,31 +1,17 @@
|
|||
cloud.google.com/go v0.34.0 h1:eOI3/cP2VTU6uZLDYAoic+eyzzB9YyGmJ7eIjl8rOPg=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/PuerkitoBio/purell v1.1.0 h1:rmGxhojJlM0tuKtfdvliR84CFHljx9ag64t2xmVkjK4=
|
||||
github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/emicklei/go-restful v2.8.1+incompatible h1:AyDqLHbJ1quqbWr/OWDw+PlIP8ZFoTmYrGYaxzrLbNg=
|
||||
github.com/emicklei/go-restful v2.8.1+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
|
||||
github.com/evanphx/json-patch v4.1.0+incompatible h1:K1MDoo4AZ4wU0GIU/fPmtZg7VpzLjCxu+UwBD1FvwOc=
|
||||
github.com/evanphx/json-patch v4.1.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/gdamore/encoding v0.0.0-20151215212835-b23993cbb635 h1:hheUEMzaOie/wKeIc1WPa7CDVuIO5hqQxjS+dwTQEnI=
|
||||
github.com/gdamore/encoding v0.0.0-20151215212835-b23993cbb635/go.mod h1:yrQYJKKDTrHmbYxI7CYi+/hbdiDT2m4Hj+t0ikCjsrQ=
|
||||
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
|
||||
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
|
||||
github.com/gdamore/tcell v1.1.0 h1:RbQgl7jukmdqROeNcKps7R2YfDCQbWkOd1BwdXrxfr4=
|
||||
github.com/gdamore/tcell v1.1.0/go.mod h1:tqyG50u7+Ctv1w5VX67kLzKcj9YXR/JSBZQq/+mLl1A=
|
||||
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/go-openapi/jsonpointer v0.17.0 h1:nH6xp8XdXHx8dqveo0ZuJBluCO2qGrPbDNZ0dwoRHP0=
|
||||
github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
|
||||
github.com/go-openapi/jsonreference v0.17.0 h1:yJW3HCkTHg7NOA+gZ83IPHzUSnUzGXhGmsdiCcMexbA=
|
||||
github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
|
||||
github.com/go-openapi/spec v0.18.0 h1:aIjeyG5mo5/FrvDkpKKEGZPmF9MPHahS72mzfVqeQXQ=
|
||||
github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
|
||||
github.com/go-openapi/swag v0.17.0 h1:iqrgMg7Q7SvtbWLlltPrkMs0UBJI6oTSs79JFRUi880=
|
||||
github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
|
||||
github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||
|
|
@ -58,10 +44,10 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGi
|
|||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/lucasb-eyer/go-colorful v0.0.0-20181028223441-12d3b2882a08 h1:5MnxBC15uMxFv5FY/J/8vzyaBiArCOkMdFT9Jsw78iY=
|
||||
github.com/lucasb-eyer/go-colorful v0.0.0-20181028223441-12d3b2882a08/go.mod h1:NXg0ArsFk0Y01623LgUqoqcouGDB+PwCCQlrwrG6xJ4=
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4=
|
||||
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
|
||||
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
||||
|
|
@ -74,14 +60,12 @@ github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+v
|
|||
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
|
||||
github.com/petergtz/pegomock v0.0.0-20181206220228-b113d17a7e81 h1:MhSbvsIs4KvpPYr4taOvb6j+r9VNbj/08AfjsKi+Ui0=
|
||||
github.com/petergtz/pegomock v0.0.0-20181206220228-b113d17a7e81/go.mod h1:nuBLWZpVyv/fLo56qTwt/AUau7jgouO1h7bEvZCq82o=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 h1:Jpy1PXuP99tXNrhbq2BaPz9B+jNAvH1JPQQpG/9GCXY=
|
||||
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c h1:Ho+uVpkel/udgjbwB5Lktg9BtvJSh2DT0Hi6LPSyI2w=
|
||||
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
|
||||
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
|
||||
|
|
@ -96,9 +80,8 @@ golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd h1:VtIkGDhk0ph3t+THbvXHfM
|
|||
golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc h1:ZMCWScCvS2fUVFw8LOpxyUUW5qiviqr4Dg5NdjLeiLU=
|
||||
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc h1:a3CU5tJYVj92DY2LaA1kUkrsqD5/3mLDhx2NcNqyW+0=
|
||||
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/oauth2 v0.0.0-20181105165119-ca4130e427c7 h1:g9UOdtsRWEwHYUG2bDHMxKrvfSGE5epIX2HkaMHSMBY=
|
||||
golang.org/x/oauth2 v0.0.0-20181105165119-ca4130e427c7/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
|
@ -134,13 +117,7 @@ k8s.io/apimachinery v0.0.0-20181108045954-261df694e725 h1:b4fe6FhSyMdpi6WNeCxxr+
|
|||
k8s.io/apimachinery v0.0.0-20181108045954-261df694e725/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
|
||||
k8s.io/client-go v9.0.0+incompatible h1:2kqW3X2xQ9SbFvWZjGEHBLlWc1LG9JIJNXWkuqwdZ3A=
|
||||
k8s.io/client-go v9.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
|
||||
k8s.io/kube-openapi v0.0.0-20190131215449-d8b685cd2daa h1:BaHeFwQGkOr0hofNfYbGmI7WXu8AIWBlZ0mUWvXt+SQ=
|
||||
k8s.io/kube-openapi v0.0.0-20190131215449-d8b685cd2daa/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc=
|
||||
k8s.io/kubernetes v1.13.0 h1:2psb4AOWOU3rESSjRVkqHRIIXkqLppfeiR6YE0trpt0=
|
||||
k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
|
||||
k8s.io/metrics v0.0.0-20181121073115-d8618695b08f h1:HyUoIBzks9xTaSnMJ6kv/SSmwaQQccokuiriu2cV0aA=
|
||||
k8s.io/metrics v0.0.0-20181121073115-d8618695b08f/go.mod h1:a25VAbm3QT3xiVl1jtoF1ueAKQM149UdZ+L93ePfV3M=
|
||||
sigs.k8s.io/kind v0.0.0-20190131032353-9307ec01e70f h1:Rb8ZMMK39NO/kSyz+0RFjwhQpYKxGaRc10mXV8mVsDs=
|
||||
sigs.k8s.io/kind v0.0.0-20190131032353-9307ec01e70f/go.mod h1:4luVoV3UfY4B4ZNzvRPdM0egGo9zqFn/drRXqYPw9Ig=
|
||||
sigs.k8s.io/kustomize v1.0.11 h1:Yb+6DDt9+aR2AvQApvUaKS/ugteeG4MPyoFeUHiPOjk=
|
||||
sigs.k8s.io/kustomize v1.0.11/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
|
||||
|
|
|
|||
9
main.go
9
main.go
|
|
@ -2,19 +2,20 @@ package main
|
|||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/derailed/k9s/cmd"
|
||||
"github.com/derailed/k9s/views"
|
||||
log "github.com/sirupsen/logrus"
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
|
||||
)
|
||||
|
||||
func init() {
|
||||
file, err := os.OpenFile(path.Join("/tmp", "k9s.log"), os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
|
||||
if err != nil {
|
||||
mod := os.O_CREATE | os.O_APPEND | os.O_WRONLY
|
||||
if file, err := os.OpenFile(views.K9sLogs, mod, 0644); err == nil {
|
||||
log.SetOutput(file)
|
||||
} else {
|
||||
panic(err)
|
||||
}
|
||||
log.SetOutput(file)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import (
|
|||
func TestCMHeader(t *testing.T) {
|
||||
assert.Equal(t,
|
||||
resource.Row{"NAME", "DATA", "AGE"},
|
||||
newConfigMap().Header("default"),
|
||||
newConfigMap().Header(resource.DefaultNamespace),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import (
|
|||
)
|
||||
|
||||
func TestCRBHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"NAME", "AGE"}, newCRB().Header("default"))
|
||||
assert.Equal(t, resource.Row{"NAME", "AGE"}, newCRB().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestCRBHeaderAllNS(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ func TestCRListAccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCRHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"NAME", "AGE"}, newClusterRole().Header("default"))
|
||||
assert.Equal(t, resource.Row{"NAME", "AGE"}, newClusterRole().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestCRHeaderAllNS(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ func TestCRDListAccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCRDHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"NAME", "AGE"}, newCRD().Header("default"))
|
||||
assert.Equal(t, resource.Row{"NAME", "AGE"}, newCRD().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestCRDHeaderAllNS(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func TestCronJobListAccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCronJobHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"NAME", "SCHEDULE", "SUSPEND", "ACTIVE", "LAST_SCHEDULE", "AGE"}, newCronJob().Header("default"))
|
||||
assert.Equal(t, resource.Row{"NAME", "SCHEDULE", "SUSPEND", "ACTIVE", "LAST_SCHEDULE", "AGE"}, newCronJob().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestCronJobFields(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func TestDeploymentListAccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDeploymentHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"NAME", "DESIRED", "CURRENT", "UP-TO-DATE", "AVAILABLE", "AGE"}, newDeployment().Header("default"))
|
||||
assert.Equal(t, resource.Row{"NAME", "DESIRED", "CURRENT", "UP-TO-DATE", "AVAILABLE", "AGE"}, newDeployment().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestDeploymentFields(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func TestDSListAccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDSHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"NAME", "DESIRED", "CURRENT", "READY", "UP-TO-DATE", "AVAILABLE", "NODE_SELECTOR", "AGE"}, newDS().Header("default"))
|
||||
assert.Equal(t, resource.Row{"NAME", "DESIRED", "CURRENT", "READY", "UP-TO-DATE", "AVAILABLE", "NODE_SELECTOR", "AGE"}, newDS().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestDSFields(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func TestEndpointsListAccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestEndpointsHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"NAME", "ENDPOINTS", "AGE"}, newEndpoints().Header("default"))
|
||||
assert.Equal(t, resource.Row{"NAME", "ENDPOINTS", "AGE"}, newEndpoints().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestEndpointsFields(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func TestEventListAccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestEventHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"", "NAME", "REASON", "SOURCE", "COUNT", "MESSAGE", "AGE"}, newEvent().Header("default"))
|
||||
assert.Equal(t, resource.Row{"", "NAME", "REASON", "SOURCE", "COUNT", "MESSAGE", "AGE"}, newEvent().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestEventFields(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,11 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
// AllNamespaces indicator to retrieve K8s resource for all namespaces
|
||||
// DefaultNamespace indicator to fetch default namespace.
|
||||
DefaultNamespace = "default"
|
||||
// AllNamespace namespace name to span all namespaces.
|
||||
AllNamespace = "all"
|
||||
// AllNamespaces indicator to retrieve K8s resource for all namespaces.
|
||||
AllNamespaces = ""
|
||||
// NotNamespaced indicator for non namespaced resource.
|
||||
NotNamespaced = "-"
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func TestHPAListAccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHPAHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"NAME", "REFERENCE", "TARGETS", "MINPODS", "MAXPODS", "REPLICAS", "AGE"}, newHPA().Header("default"))
|
||||
assert.Equal(t, resource.Row{"NAME", "REFERENCE", "TARGETS", "MINPODS", "MAXPODS", "REPLICAS", "AGE"}, newHPA().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestHPAFields(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func TestIngressListAccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestIngressHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"NAME", "HOSTS", "ADDRESS", "PORT", "AGE"}, newIngress().Header("default"))
|
||||
assert.Equal(t, resource.Row{"NAME", "HOSTS", "ADDRESS", "PORT", "AGE"}, newIngress().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestIngressFields(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func TestJobListAccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestJobHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"NAME", "COMPLETIONS", "DURATION", "AGE"}, newJob().Header("default"))
|
||||
assert.Equal(t, resource.Row{"NAME", "COMPLETIONS", "DURATION", "AGE"}, newJob().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestJobFields(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ type (
|
|||
}
|
||||
|
||||
connection interface {
|
||||
configOrDie() *restclient.Config
|
||||
dialConfigOrDie() *clientcmdapi.Config
|
||||
restConfigOrDie() *restclient.Config
|
||||
apiConfigOrDie() *clientcmdapi.Config
|
||||
dialOrDie() kubernetes.Interface
|
||||
dynDialOrDie() dynamic.Interface
|
||||
nsDialOrDie() dynamic.NamespaceableResourceInterface
|
||||
|
|
@ -85,14 +85,6 @@ func (a *apiServer) hasMetricsServer() bool {
|
|||
return a.useMetricServer
|
||||
}
|
||||
|
||||
func (a *apiServer) dialConfigOrDie() *clientcmdapi.Config {
|
||||
c, err := clientcmd.NewDefaultPathOptions().GetStartingConfig()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
// DialOrDie returns a handle to api server or die.
|
||||
func (a *apiServer) dialOrDie() kubernetes.Interface {
|
||||
a.checkCurrentConfig()
|
||||
|
|
@ -101,8 +93,8 @@ func (a *apiServer) dialOrDie() kubernetes.Interface {
|
|||
}
|
||||
|
||||
var err error
|
||||
if a.client, err = kubernetes.NewForConfig(a.configOrDie()); err != nil {
|
||||
log.Fatal(err)
|
||||
if a.client, err = kubernetes.NewForConfig(a.restConfigOrDie()); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return a.client
|
||||
|
|
@ -118,7 +110,7 @@ func (a *apiServer) csDialOrDie() *clientset.Clientset {
|
|||
// cfg := clientcmd.NewNonInteractiveClientConfig(config, contextName, overrides, configAccess)
|
||||
var err error
|
||||
if a.csClient, err = clientset.NewForConfig(cfg); err != nil {
|
||||
log.Fatal(err)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return a.csClient
|
||||
|
|
@ -132,8 +124,8 @@ func (a *apiServer) dynDialOrDie() dynamic.Interface {
|
|||
}
|
||||
|
||||
var err error
|
||||
if a.dClient, err = dynamic.NewForConfig(a.configOrDie()); err != nil {
|
||||
log.Fatal(err)
|
||||
if a.dClient, err = dynamic.NewForConfig(a.restConfigOrDie()); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return a.dClient
|
||||
|
|
@ -189,11 +181,30 @@ func (a *apiServer) mxsDial() (*versioned.Clientset, error) {
|
|||
return a.mxsClient, err
|
||||
}
|
||||
|
||||
func (*apiServer) configOrDie() *restclient.Config {
|
||||
// ConfigOrDie check kubernetes cluster config.
|
||||
// Dies if no config is found or incorrect.
|
||||
func ConfigOrDie() {
|
||||
var srv *apiServer
|
||||
cfg := srv.apiConfigOrDie()
|
||||
if clientcmdapi.IsConfigEmpty(cfg) {
|
||||
panic("K8s config file load failed. Please check your .kube/config or $KUBECONFIG env")
|
||||
}
|
||||
}
|
||||
|
||||
func (*apiServer) apiConfigOrDie() *clientcmdapi.Config {
|
||||
paths := clientcmd.NewDefaultPathOptions()
|
||||
c, err := paths.GetStartingConfig()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
func (*apiServer) restConfigOrDie() *restclient.Config {
|
||||
opts := clientcmd.NewDefaultPathOptions()
|
||||
cfg, err := clientcmd.BuildConfigFromFlags("", opts.GetDefaultFilename())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
panic(err)
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,12 +34,12 @@ func NewContext() Res {
|
|||
|
||||
// Get a Context.
|
||||
func (*Context) Get(_, n string) (interface{}, error) {
|
||||
return &NamedContext{Name: n, Context: conn.dialConfigOrDie().Contexts[n]}, nil
|
||||
return &NamedContext{Name: n, Context: conn.apiConfigOrDie().Contexts[n]}, nil
|
||||
}
|
||||
|
||||
// List all Contexts in a given namespace
|
||||
func (*Context) List(string) (Collection, error) {
|
||||
conn := conn.dialConfigOrDie()
|
||||
conn := conn.apiConfigOrDie()
|
||||
|
||||
cc := make([]interface{}, 0, len(conn.Contexts))
|
||||
for k, v := range conn.Contexts {
|
||||
|
|
@ -50,7 +50,7 @@ func (*Context) List(string) (Collection, error) {
|
|||
|
||||
// Delete a Context
|
||||
func (*Context) Delete(_, n string) error {
|
||||
conn := conn.dialConfigOrDie()
|
||||
conn := conn.apiConfigOrDie()
|
||||
|
||||
if conn.CurrentContext == n {
|
||||
return fmt.Errorf("trying to delete your current context %s", n)
|
||||
|
|
@ -64,7 +64,7 @@ func (*Context) Delete(_, n string) error {
|
|||
|
||||
// Switch cluster Context.
|
||||
func (*Context) Switch(n string) error {
|
||||
conn := conn.dialConfigOrDie()
|
||||
conn := conn.apiConfigOrDie()
|
||||
|
||||
conn.CurrentContext = n
|
||||
acc := clientcmd.NewDefaultPathOptions()
|
||||
|
|
|
|||
|
|
@ -6,17 +6,19 @@ import (
|
|||
restclient "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
const defaultTailLines = 10
|
||||
const defaultKillGrace int64 = 5
|
||||
|
||||
// PodRes represents a K8s pod resource.
|
||||
type PodRes interface {
|
||||
Res
|
||||
Containers(ns, n string) ([]string, error)
|
||||
Logs(ns, n, co string) *restclient.Request
|
||||
}
|
||||
type (
|
||||
// PodRes represents a K8s pod resource.
|
||||
PodRes interface {
|
||||
Res
|
||||
Containers(ns, n string) ([]string, error)
|
||||
Logs(ns, n, co string, lines int64) *restclient.Request
|
||||
}
|
||||
|
||||
// Pod represents a Kubernetes service
|
||||
type Pod struct{}
|
||||
// Pod represents a Kubernetes resource.
|
||||
Pod struct{}
|
||||
)
|
||||
|
||||
// NewPod returns a new Pod.
|
||||
func NewPod() Res {
|
||||
|
|
@ -48,7 +50,10 @@ func (*Pod) List(ns string) (Collection, error) {
|
|||
|
||||
// Delete a service
|
||||
func (*Pod) Delete(ns, n string) error {
|
||||
opts := metav1.DeleteOptions{}
|
||||
var grace = defaultKillGrace
|
||||
opts := metav1.DeleteOptions{
|
||||
GracePeriodSeconds: &grace,
|
||||
}
|
||||
return conn.dialOrDie().CoreV1().Pods(ns).Delete(n, &opts)
|
||||
}
|
||||
|
||||
|
|
@ -68,12 +73,11 @@ func (*Pod) Containers(ns, n string) ([]string, error) {
|
|||
}
|
||||
|
||||
// Logs fetch container logs for a given pod and container.
|
||||
func (*Pod) Logs(ns, n, co string) *restclient.Request {
|
||||
tl := int64(defaultTailLines)
|
||||
func (*Pod) Logs(ns, n, co string, lines int64) *restclient.Request {
|
||||
opts := &v1.PodLogOptions{
|
||||
Container: co,
|
||||
Follow: true,
|
||||
TailLines: &tl,
|
||||
TailLines: &lines,
|
||||
}
|
||||
return conn.dialOrDie().CoreV1().Pods(ns).GetLogs(n, opts)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ func (r *Resource) Delete(ns, n string) error {
|
|||
func (r *Resource) getClient() *rest.RESTClient {
|
||||
gv := schema.GroupVersion{Group: r.group, Version: r.version}
|
||||
codecs, _ := r.codecs()
|
||||
crConfig := *conn.configOrDie()
|
||||
crConfig := *conn.restConfigOrDie()
|
||||
crConfig.GroupVersion = &gv
|
||||
crConfig.APIPath = "/apis"
|
||||
if len(r.group) == 0 {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"sort"
|
||||
|
||||
"github.com/derailed/k9s/resource/k8s"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
)
|
||||
|
||||
|
|
@ -62,6 +63,8 @@ type (
|
|||
List interface {
|
||||
Data() TableData
|
||||
Resource() Resource
|
||||
Namespaced() bool
|
||||
AllNamespaces() bool
|
||||
GetNamespace() string
|
||||
SetNamespace(string)
|
||||
Reconcile() error
|
||||
|
|
@ -143,6 +146,16 @@ func (l *list) Access(f int) bool {
|
|||
return l.verbs&f == f
|
||||
}
|
||||
|
||||
// Namespaced checks if k8s resource is namespaced.
|
||||
func (l *list) Namespaced() bool {
|
||||
return l.namespace != NotNamespaced
|
||||
}
|
||||
|
||||
// AllNamespaces checks if this resource spans all namespaces.
|
||||
func (l *list) AllNamespaces() bool {
|
||||
return l.namespace == AllNamespaces
|
||||
}
|
||||
|
||||
// GetNamespace associated with the resource.
|
||||
func (l *list) GetNamespace() string {
|
||||
if !l.Access(NamespaceAccess) {
|
||||
|
|
@ -154,12 +167,18 @@ func (l *list) GetNamespace() string {
|
|||
// SetNamespace updates the namespace on the list. Default ns is "" for all
|
||||
// namespaces.
|
||||
func (l *list) SetNamespace(n string) {
|
||||
if n == AllNamespace {
|
||||
n = AllNamespaces
|
||||
}
|
||||
if l.namespace == n {
|
||||
return
|
||||
}
|
||||
l.cache = RowEvents{}
|
||||
if l.Access(NamespaceAccess) {
|
||||
l.namespace = n
|
||||
if n == AllNamespace {
|
||||
l.namespace = AllNamespaces
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -199,6 +218,7 @@ func (l *list) Reconcile() error {
|
|||
err error
|
||||
)
|
||||
|
||||
log.Debugf("Fetching list for resource `%s` in ns `%s`", l.name, l.namespace)
|
||||
if items, err = l.api.List(l.namespace); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -218,7 +238,7 @@ func (l *list) Reconcile() error {
|
|||
dd := make(Row, len(ff))
|
||||
kk = append(kk, i.Name())
|
||||
if evt, ok := l.cache[i.Name()]; ok {
|
||||
f1, f2 := evt.Fields[:len(evt.Fields)-2], ff[:len(ff)-2]
|
||||
f1, f2 := evt.Fields[:len(evt.Fields)-1], ff[:len(ff)-1]
|
||||
a = Unchanged
|
||||
if !reflect.DeepEqual(f1, f2) {
|
||||
for i, f := range f1 {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func TestNamespaceListAccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestNamespaceHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"NAME", "STATUS", "AGE"}, newNamespace().Header("default"))
|
||||
assert.Equal(t, resource.Row{"NAME", "STATUS", "AGE"}, newNamespace().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestNamespaceFields(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
const defaultTimeout = 3
|
||||
const defaultTimeout = 1*time.Second
|
||||
|
||||
type (
|
||||
// Container represents a resource that encompass multiple containers.
|
||||
|
|
@ -23,7 +23,7 @@ type (
|
|||
|
||||
// Tailable represents a resource with tailable logs.
|
||||
Tailable interface {
|
||||
Logs(c chan<- string, ns, na, co string) (context.CancelFunc, error)
|
||||
Logs(c chan<- string, ns, na, co string, lines int64) (context.CancelFunc, error)
|
||||
}
|
||||
|
||||
// TailableResource is a resource that have tailable logs.
|
||||
|
|
@ -125,15 +125,15 @@ func (r *Pod) Containers(path string) ([]string, error) {
|
|||
}
|
||||
|
||||
// Logs tails a given container logs
|
||||
func (r *Pod) Logs(c chan<- string, ns, n, co string) (context.CancelFunc, error) {
|
||||
req := r.caller.(k8s.PodRes).Logs(ns, n, co)
|
||||
func (r *Pod) Logs(c chan<- string, ns, n, co string, lines int64) (context.CancelFunc, error) {
|
||||
req := r.caller.(k8s.PodRes).Logs(ns, n, co, lines)
|
||||
ctx, cancel := context.WithCancel(context.TODO())
|
||||
req.Context(ctx)
|
||||
|
||||
blocked := true
|
||||
go func() {
|
||||
select {
|
||||
case <-time.After(1 * time.Second):
|
||||
case <-time.After(defaultTimeout):
|
||||
if blocked {
|
||||
close(c)
|
||||
cancel()
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func TestPodListAccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPodHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"NAME", "READY", "STATUS", "RESTARTS", "CPU", "MEM", "IP", "NODE", "QOS", "AGE"}, newPod().Header("default"))
|
||||
assert.Equal(t, resource.Row{"NAME", "READY", "STATUS", "RESTARTS", "CPU", "MEM", "IP", "NODE", "QOS", "AGE"}, newPod().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestPodFields(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func TestPVListAccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPVHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"NAME", "CAPACITY", "ACCESS MODES", "RECLAIM POLICY", "STATUS", "CLAIM", "STORAGECLASS", "REASON", "AGE"}, newPV().Header("default"))
|
||||
assert.Equal(t, resource.Row{"NAME", "CAPACITY", "ACCESS MODES", "RECLAIM POLICY", "STATUS", "CLAIM", "STORAGECLASS", "REASON", "AGE"}, newPV().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestPVFields(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ func TestPVCListAccess(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPVCHeader(t *testing.T) {
|
||||
assert.Equal(t, resource.Row{"NAME", "STATUS", "VOLUME", "CAPACITY", "ACCESS MODES", "STORAGECLASS", "AGE"}, newPVC().Header("default"))
|
||||
assert.Equal(t, resource.Row{"NAME", "STATUS", "VOLUME", "CAPACITY", "ACCESS MODES", "STORAGECLASS", "AGE"}, newPVC().Header(resource.DefaultNamespace))
|
||||
}
|
||||
|
||||
func TestPVCFields(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import (
|
|||
func TestSecretHeader(t *testing.T) {
|
||||
assert.Equal(t,
|
||||
resource.Row{"NAME", "TYPE", "DATA", "AGE"},
|
||||
newSecret().Header("default"),
|
||||
newSecret().Header(resource.DefaultNamespace),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
k9s:
|
||||
refreshRate: 10
|
||||
namespace:
|
||||
active: fred
|
||||
favorites:
|
||||
- blee
|
||||
- duh
|
||||
- crap
|
||||
|
|
@ -446,11 +446,11 @@ func (c *Client) ProjectAttributeValue(attr string) (string, error) {
|
|||
}
|
||||
|
||||
// Scopes returns the service account scopes for the given account.
|
||||
// The account may be empty or the string "default" to use the instance's
|
||||
// The account may be empty or the string (resource.DefaultNamespace) to use the instance's
|
||||
// main account.
|
||||
func (c *Client) Scopes(serviceAccount string) ([]string, error) {
|
||||
if serviceAccount == "" {
|
||||
serviceAccount = "default"
|
||||
serviceAccount = (resource.DefaultNamespace)
|
||||
}
|
||||
return c.lines("instance/service-accounts/" + serviceAccount + "/scopes")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.3
|
||||
- 1.5
|
||||
- 1.9.x
|
||||
- 1.10.x
|
||||
- 1.11.x
|
||||
- tip
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ import (
|
|||
"sync"
|
||||
"unicode/utf8"
|
||||
|
||||
"golang.org/x/text/transform"
|
||||
"golang.org/x/text/encoding"
|
||||
"golang.org/x/text/transform"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -135,8 +135,12 @@ func (c *Charmap) NewDecoder() *encoding.Decoder {
|
|||
// 8-bit character set. Unknown mappings are mapped to 0x1A.
|
||||
func (c *Charmap) NewEncoder() *encoding.Encoder {
|
||||
c.Init()
|
||||
return &encoding.Encoder{Transformer:
|
||||
&cmapEncoder{bytes: c.bytes, replace: c.ReplacementChar}}
|
||||
return &encoding.Encoder{
|
||||
Transformer: &cmapEncoder{
|
||||
bytes: c.bytes,
|
||||
replace: c.ReplacementChar,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (d *cmapDecoder) Transform(dst, src []byte, atEOF bool) (int, int, error) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
module github.com/gdamore/encoding
|
||||
|
||||
go 1.9
|
||||
|
||||
require golang.org/x/text v0.3.0
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
|
@ -869,7 +869,7 @@ func NewFileSchema(in interface{}, context *compiler.Context) (*FileSchema, erro
|
|||
message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
|
||||
errors = append(errors, compiler.NewError(context, message))
|
||||
}
|
||||
allowedKeys := []string{"default", "description", "example", "externalDocs", "format", "readOnly", "required", "title", "type"}
|
||||
allowedKeys := []string{(resource.DefaultNamespace), "description", "example", "externalDocs", "format", "readOnly", "required", "title", "type"}
|
||||
allowedPatterns := []*regexp.Regexp{pattern0}
|
||||
invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
|
||||
if len(invalidKeys) > 0 {
|
||||
|
|
@ -904,10 +904,10 @@ func NewFileSchema(in interface{}, context *compiler.Context) (*FileSchema, erro
|
|||
}
|
||||
}
|
||||
// Any default = 4;
|
||||
v4 := compiler.MapValueForKey(m, "default")
|
||||
v4 := compiler.MapValueForKey(m, (resource.DefaultNamespace))
|
||||
if v4 != nil {
|
||||
var err error
|
||||
x.Default, err = NewAny(v4, compiler.NewContext("default", context))
|
||||
x.Default, err = NewAny(v4, compiler.NewContext((resource.DefaultNamespace), context))
|
||||
if err != nil {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
|
@ -1009,7 +1009,7 @@ func NewFormDataParameterSubSchema(in interface{}, context *compiler.Context) (*
|
|||
message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
|
||||
errors = append(errors, compiler.NewError(context, message))
|
||||
} else {
|
||||
allowedKeys := []string{"allowEmptyValue", "collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
|
||||
allowedKeys := []string{"allowEmptyValue", "collectionFormat", (resource.DefaultNamespace), "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
|
||||
allowedPatterns := []*regexp.Regexp{pattern0}
|
||||
invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
|
||||
if len(invalidKeys) > 0 {
|
||||
|
|
@ -1116,10 +1116,10 @@ func NewFormDataParameterSubSchema(in interface{}, context *compiler.Context) (*
|
|||
}
|
||||
}
|
||||
// Any default = 10;
|
||||
v10 := compiler.MapValueForKey(m, "default")
|
||||
v10 := compiler.MapValueForKey(m, (resource.DefaultNamespace))
|
||||
if v10 != nil {
|
||||
var err error
|
||||
x.Default, err = NewAny(v10, compiler.NewContext("default", context))
|
||||
x.Default, err = NewAny(v10, compiler.NewContext((resource.DefaultNamespace), context))
|
||||
if err != nil {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
|
@ -1339,7 +1339,7 @@ func NewHeader(in interface{}, context *compiler.Context) (*Header, error) {
|
|||
message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
|
||||
errors = append(errors, compiler.NewError(context, message))
|
||||
}
|
||||
allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"}
|
||||
allowedKeys := []string{"collectionFormat", (resource.DefaultNamespace), "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"}
|
||||
allowedPatterns := []*regexp.Regexp{pattern0}
|
||||
invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
|
||||
if len(invalidKeys) > 0 {
|
||||
|
|
@ -1395,10 +1395,10 @@ func NewHeader(in interface{}, context *compiler.Context) (*Header, error) {
|
|||
}
|
||||
}
|
||||
// Any default = 5;
|
||||
v5 := compiler.MapValueForKey(m, "default")
|
||||
v5 := compiler.MapValueForKey(m, (resource.DefaultNamespace))
|
||||
if v5 != nil {
|
||||
var err error
|
||||
x.Default, err = NewAny(v5, compiler.NewContext("default", context))
|
||||
x.Default, err = NewAny(v5, compiler.NewContext((resource.DefaultNamespace), context))
|
||||
if err != nil {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
|
@ -1621,7 +1621,7 @@ func NewHeaderParameterSubSchema(in interface{}, context *compiler.Context) (*He
|
|||
message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
|
||||
errors = append(errors, compiler.NewError(context, message))
|
||||
} else {
|
||||
allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
|
||||
allowedKeys := []string{"collectionFormat", (resource.DefaultNamespace), "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
|
||||
allowedPatterns := []*regexp.Regexp{pattern0}
|
||||
invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
|
||||
if len(invalidKeys) > 0 {
|
||||
|
|
@ -1719,10 +1719,10 @@ func NewHeaderParameterSubSchema(in interface{}, context *compiler.Context) (*He
|
|||
}
|
||||
}
|
||||
// Any default = 9;
|
||||
v9 := compiler.MapValueForKey(m, "default")
|
||||
v9 := compiler.MapValueForKey(m, (resource.DefaultNamespace))
|
||||
if v9 != nil {
|
||||
var err error
|
||||
x.Default, err = NewAny(v9, compiler.NewContext("default", context))
|
||||
x.Default, err = NewAny(v9, compiler.NewContext((resource.DefaultNamespace), context))
|
||||
if err != nil {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
|
@ -3602,7 +3602,7 @@ func NewPathParameterSubSchema(in interface{}, context *compiler.Context) (*Path
|
|||
message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
|
||||
errors = append(errors, compiler.NewError(context, message))
|
||||
}
|
||||
allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
|
||||
allowedKeys := []string{"collectionFormat", (resource.DefaultNamespace), "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
|
||||
allowedPatterns := []*regexp.Regexp{pattern0}
|
||||
invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
|
||||
if len(invalidKeys) > 0 {
|
||||
|
|
@ -3700,10 +3700,10 @@ func NewPathParameterSubSchema(in interface{}, context *compiler.Context) (*Path
|
|||
}
|
||||
}
|
||||
// Any default = 9;
|
||||
v9 := compiler.MapValueForKey(m, "default")
|
||||
v9 := compiler.MapValueForKey(m, (resource.DefaultNamespace))
|
||||
if v9 != nil {
|
||||
var err error
|
||||
x.Default, err = NewAny(v9, compiler.NewContext("default", context))
|
||||
x.Default, err = NewAny(v9, compiler.NewContext((resource.DefaultNamespace), context))
|
||||
if err != nil {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
|
@ -3987,7 +3987,7 @@ func NewPrimitivesItems(in interface{}, context *compiler.Context) (*PrimitivesI
|
|||
message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
|
||||
errors = append(errors, compiler.NewError(context, message))
|
||||
} else {
|
||||
allowedKeys := []string{"collectionFormat", "default", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"}
|
||||
allowedKeys := []string{"collectionFormat", (resource.DefaultNamespace), "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"}
|
||||
allowedPatterns := []*regexp.Regexp{pattern0}
|
||||
invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
|
||||
if len(invalidKeys) > 0 {
|
||||
|
|
@ -4043,10 +4043,10 @@ func NewPrimitivesItems(in interface{}, context *compiler.Context) (*PrimitivesI
|
|||
}
|
||||
}
|
||||
// Any default = 5;
|
||||
v5 := compiler.MapValueForKey(m, "default")
|
||||
v5 := compiler.MapValueForKey(m, (resource.DefaultNamespace))
|
||||
if v5 != nil {
|
||||
var err error
|
||||
x.Default, err = NewAny(v5, compiler.NewContext("default", context))
|
||||
x.Default, err = NewAny(v5, compiler.NewContext((resource.DefaultNamespace), context))
|
||||
if err != nil {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
|
@ -4290,7 +4290,7 @@ func NewQueryParameterSubSchema(in interface{}, context *compiler.Context) (*Que
|
|||
message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
|
||||
errors = append(errors, compiler.NewError(context, message))
|
||||
} else {
|
||||
allowedKeys := []string{"allowEmptyValue", "collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
|
||||
allowedKeys := []string{"allowEmptyValue", "collectionFormat", (resource.DefaultNamespace), "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
|
||||
allowedPatterns := []*regexp.Regexp{pattern0}
|
||||
invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
|
||||
if len(invalidKeys) > 0 {
|
||||
|
|
@ -4397,10 +4397,10 @@ func NewQueryParameterSubSchema(in interface{}, context *compiler.Context) (*Que
|
|||
}
|
||||
}
|
||||
// Any default = 10;
|
||||
v10 := compiler.MapValueForKey(m, "default")
|
||||
v10 := compiler.MapValueForKey(m, (resource.DefaultNamespace))
|
||||
if v10 != nil {
|
||||
var err error
|
||||
x.Default, err = NewAny(v10, compiler.NewContext("default", context))
|
||||
x.Default, err = NewAny(v10, compiler.NewContext((resource.DefaultNamespace), context))
|
||||
if err != nil {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
|
@ -4847,7 +4847,7 @@ func NewSchema(in interface{}, context *compiler.Context) (*Schema, error) {
|
|||
message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
|
||||
errors = append(errors, compiler.NewError(context, message))
|
||||
} else {
|
||||
allowedKeys := []string{"$ref", "additionalProperties", "allOf", "default", "description", "discriminator", "enum", "example", "exclusiveMaximum", "exclusiveMinimum", "externalDocs", "format", "items", "maxItems", "maxLength", "maxProperties", "maximum", "minItems", "minLength", "minProperties", "minimum", "multipleOf", "pattern", "properties", "readOnly", "required", "title", "type", "uniqueItems", "xml"}
|
||||
allowedKeys := []string{"$ref", "additionalProperties", "allOf", (resource.DefaultNamespace), "description", "discriminator", "enum", "example", "exclusiveMaximum", "exclusiveMinimum", "externalDocs", "format", "items", "maxItems", "maxLength", "maxProperties", "maximum", "minItems", "minLength", "minProperties", "minimum", "multipleOf", "pattern", "properties", "readOnly", "required", "title", "type", "uniqueItems", "xml"}
|
||||
allowedPatterns := []*regexp.Regexp{pattern0}
|
||||
invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
|
||||
if len(invalidKeys) > 0 {
|
||||
|
|
@ -4891,10 +4891,10 @@ func NewSchema(in interface{}, context *compiler.Context) (*Schema, error) {
|
|||
}
|
||||
}
|
||||
// Any default = 5;
|
||||
v5 := compiler.MapValueForKey(m, "default")
|
||||
v5 := compiler.MapValueForKey(m, (resource.DefaultNamespace))
|
||||
if v5 != nil {
|
||||
var err error
|
||||
x.Default, err = NewAny(v5, compiler.NewContext("default", context))
|
||||
x.Default, err = NewAny(v5, compiler.NewContext((resource.DefaultNamespace), context))
|
||||
if err != nil {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
|
@ -7334,7 +7334,7 @@ func (m *FileSchema) ToRawInfo() interface{} {
|
|||
info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
|
||||
}
|
||||
if m.Default != nil {
|
||||
info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
|
||||
info = append(info, yaml.MapItem{Key: (resource.DefaultNamespace), Value: m.Default.ToRawInfo()})
|
||||
}
|
||||
// &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
|
||||
if len(m.Required) != 0 {
|
||||
|
|
@ -7395,7 +7395,7 @@ func (m *FormDataParameterSubSchema) ToRawInfo() interface{} {
|
|||
info = append(info, yaml.MapItem{Key: "collectionFormat", Value: m.CollectionFormat})
|
||||
}
|
||||
if m.Default != nil {
|
||||
info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
|
||||
info = append(info, yaml.MapItem{Key: (resource.DefaultNamespace), Value: m.Default.ToRawInfo()})
|
||||
}
|
||||
// &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
|
||||
if m.Maximum != 0.0 {
|
||||
|
|
@ -7465,7 +7465,7 @@ func (m *Header) ToRawInfo() interface{} {
|
|||
info = append(info, yaml.MapItem{Key: "collectionFormat", Value: m.CollectionFormat})
|
||||
}
|
||||
if m.Default != nil {
|
||||
info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
|
||||
info = append(info, yaml.MapItem{Key: (resource.DefaultNamespace), Value: m.Default.ToRawInfo()})
|
||||
}
|
||||
// &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
|
||||
if m.Maximum != 0.0 {
|
||||
|
|
@ -7550,7 +7550,7 @@ func (m *HeaderParameterSubSchema) ToRawInfo() interface{} {
|
|||
info = append(info, yaml.MapItem{Key: "collectionFormat", Value: m.CollectionFormat})
|
||||
}
|
||||
if m.Default != nil {
|
||||
info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
|
||||
info = append(info, yaml.MapItem{Key: (resource.DefaultNamespace), Value: m.Default.ToRawInfo()})
|
||||
}
|
||||
// &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
|
||||
if m.Maximum != 0.0 {
|
||||
|
|
@ -8128,7 +8128,7 @@ func (m *PathParameterSubSchema) ToRawInfo() interface{} {
|
|||
info = append(info, yaml.MapItem{Key: "collectionFormat", Value: m.CollectionFormat})
|
||||
}
|
||||
if m.Default != nil {
|
||||
info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
|
||||
info = append(info, yaml.MapItem{Key: (resource.DefaultNamespace), Value: m.Default.ToRawInfo()})
|
||||
}
|
||||
// &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
|
||||
if m.Maximum != 0.0 {
|
||||
|
|
@ -8216,7 +8216,7 @@ func (m *PrimitivesItems) ToRawInfo() interface{} {
|
|||
info = append(info, yaml.MapItem{Key: "collectionFormat", Value: m.CollectionFormat})
|
||||
}
|
||||
if m.Default != nil {
|
||||
info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
|
||||
info = append(info, yaml.MapItem{Key: (resource.DefaultNamespace), Value: m.Default.ToRawInfo()})
|
||||
}
|
||||
// &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
|
||||
if m.Maximum != 0.0 {
|
||||
|
|
@ -8313,7 +8313,7 @@ func (m *QueryParameterSubSchema) ToRawInfo() interface{} {
|
|||
info = append(info, yaml.MapItem{Key: "collectionFormat", Value: m.CollectionFormat})
|
||||
}
|
||||
if m.Default != nil {
|
||||
info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
|
||||
info = append(info, yaml.MapItem{Key: (resource.DefaultNamespace), Value: m.Default.ToRawInfo()})
|
||||
}
|
||||
// &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
|
||||
if m.Maximum != 0.0 {
|
||||
|
|
@ -8456,7 +8456,7 @@ func (m *Schema) ToRawInfo() interface{} {
|
|||
info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
|
||||
}
|
||||
if m.Default != nil {
|
||||
info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
|
||||
info = append(info, yaml.MapItem{Key: (resource.DefaultNamespace), Value: m.Default.ToRawInfo()})
|
||||
}
|
||||
// &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
|
||||
if m.MultipleOf != 0.0 {
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@
|
|||
},
|
||||
"deprecated": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
(resource.DefaultNamespace): false
|
||||
},
|
||||
"security": {
|
||||
"$ref": "#/definitions/security"
|
||||
|
|
@ -439,7 +439,7 @@
|
|||
"collectionFormat": {
|
||||
"$ref": "#/definitions/collectionFormat"
|
||||
},
|
||||
"default": {
|
||||
(resource.DefaultNamespace): {
|
||||
"$ref": "#/definitions/default"
|
||||
},
|
||||
"maximum": {
|
||||
|
|
@ -524,7 +524,7 @@
|
|||
"required": {
|
||||
"type": "boolean",
|
||||
"description": "Determines whether or not this parameter is required or optional.",
|
||||
"default": false
|
||||
(resource.DefaultNamespace): false
|
||||
},
|
||||
"schema": {
|
||||
"$ref": "#/definitions/schema"
|
||||
|
|
@ -543,7 +543,7 @@
|
|||
"required": {
|
||||
"type": "boolean",
|
||||
"description": "Determines whether or not this parameter is required or optional.",
|
||||
"default": false
|
||||
(resource.DefaultNamespace): false
|
||||
},
|
||||
"in": {
|
||||
"type": "string",
|
||||
|
|
@ -579,7 +579,7 @@
|
|||
"collectionFormat": {
|
||||
"$ref": "#/definitions/collectionFormat"
|
||||
},
|
||||
"default": {
|
||||
(resource.DefaultNamespace): {
|
||||
"$ref": "#/definitions/default"
|
||||
},
|
||||
"maximum": {
|
||||
|
|
@ -631,7 +631,7 @@
|
|||
"required": {
|
||||
"type": "boolean",
|
||||
"description": "Determines whether or not this parameter is required or optional.",
|
||||
"default": false
|
||||
(resource.DefaultNamespace): false
|
||||
},
|
||||
"in": {
|
||||
"type": "string",
|
||||
|
|
@ -650,7 +650,7 @@
|
|||
},
|
||||
"allowEmptyValue": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
(resource.DefaultNamespace): false,
|
||||
"description": "allows sending a parameter by name only or with an empty value."
|
||||
},
|
||||
"type": {
|
||||
|
|
@ -672,7 +672,7 @@
|
|||
"collectionFormat": {
|
||||
"$ref": "#/definitions/collectionFormatWithMulti"
|
||||
},
|
||||
"default": {
|
||||
(resource.DefaultNamespace): {
|
||||
"$ref": "#/definitions/default"
|
||||
},
|
||||
"maximum": {
|
||||
|
|
@ -724,7 +724,7 @@
|
|||
"required": {
|
||||
"type": "boolean",
|
||||
"description": "Determines whether or not this parameter is required or optional.",
|
||||
"default": false
|
||||
(resource.DefaultNamespace): false
|
||||
},
|
||||
"in": {
|
||||
"type": "string",
|
||||
|
|
@ -743,7 +743,7 @@
|
|||
},
|
||||
"allowEmptyValue": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
(resource.DefaultNamespace): false,
|
||||
"description": "allows sending a parameter by name only or with an empty value."
|
||||
},
|
||||
"type": {
|
||||
|
|
@ -766,7 +766,7 @@
|
|||
"collectionFormat": {
|
||||
"$ref": "#/definitions/collectionFormatWithMulti"
|
||||
},
|
||||
"default": {
|
||||
(resource.DefaultNamespace): {
|
||||
"$ref": "#/definitions/default"
|
||||
},
|
||||
"maximum": {
|
||||
|
|
@ -859,7 +859,7 @@
|
|||
"collectionFormat": {
|
||||
"$ref": "#/definitions/collectionFormat"
|
||||
},
|
||||
"default": {
|
||||
(resource.DefaultNamespace): {
|
||||
"$ref": "#/definitions/default"
|
||||
},
|
||||
"maximum": {
|
||||
|
|
@ -953,7 +953,7 @@
|
|||
"description": {
|
||||
"$ref": "http://json-schema.org/draft-04/schema#/properties/description"
|
||||
},
|
||||
"default": {
|
||||
(resource.DefaultNamespace): {
|
||||
"$ref": "http://json-schema.org/draft-04/schema#/properties/default"
|
||||
},
|
||||
"multipleOf": {
|
||||
|
|
@ -1010,7 +1010,7 @@
|
|||
"type": "boolean"
|
||||
}
|
||||
],
|
||||
"default": {}
|
||||
(resource.DefaultNamespace): {}
|
||||
},
|
||||
"type": {
|
||||
"$ref": "http://json-schema.org/draft-04/schema#/properties/type"
|
||||
|
|
@ -1028,7 +1028,7 @@
|
|||
}
|
||||
}
|
||||
],
|
||||
"default": {}
|
||||
(resource.DefaultNamespace): {}
|
||||
},
|
||||
"allOf": {
|
||||
"type": "array",
|
||||
|
|
@ -1042,14 +1042,14 @@
|
|||
"additionalProperties": {
|
||||
"$ref": "#/definitions/schema"
|
||||
},
|
||||
"default": {}
|
||||
(resource.DefaultNamespace): {}
|
||||
},
|
||||
"discriminator": {
|
||||
"type": "string"
|
||||
},
|
||||
"readOnly": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
(resource.DefaultNamespace): false
|
||||
},
|
||||
"xml": {
|
||||
"$ref": "#/definitions/xml"
|
||||
|
|
@ -1082,7 +1082,7 @@
|
|||
"description": {
|
||||
"$ref": "http://json-schema.org/draft-04/schema#/properties/description"
|
||||
},
|
||||
"default": {
|
||||
(resource.DefaultNamespace): {
|
||||
"$ref": "http://json-schema.org/draft-04/schema#/properties/default"
|
||||
},
|
||||
"required": {
|
||||
|
|
@ -1096,7 +1096,7 @@
|
|||
},
|
||||
"readOnly": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
(resource.DefaultNamespace): false
|
||||
},
|
||||
"externalDocs": {
|
||||
"$ref": "#/definitions/externalDocs"
|
||||
|
|
@ -1128,7 +1128,7 @@
|
|||
"collectionFormat": {
|
||||
"$ref": "#/definitions/collectionFormat"
|
||||
},
|
||||
"default": {
|
||||
(resource.DefaultNamespace): {
|
||||
"$ref": "#/definitions/default"
|
||||
},
|
||||
"maximum": {
|
||||
|
|
@ -1206,11 +1206,11 @@
|
|||
},
|
||||
"attribute": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
(resource.DefaultNamespace): false
|
||||
},
|
||||
"wrapped": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
(resource.DefaultNamespace): false
|
||||
}
|
||||
},
|
||||
"patternProperties": {
|
||||
|
|
@ -1533,7 +1533,7 @@
|
|||
"tsv",
|
||||
"pipes"
|
||||
],
|
||||
"default": "csv"
|
||||
(resource.DefaultNamespace): "csv"
|
||||
},
|
||||
"collectionFormatWithMulti": {
|
||||
"type": "string",
|
||||
|
|
@ -1544,7 +1544,7 @@
|
|||
"pipes",
|
||||
"multi"
|
||||
],
|
||||
"default": "csv"
|
||||
(resource.DefaultNamespace): "csv"
|
||||
},
|
||||
"title": {
|
||||
"$ref": "http://json-schema.org/draft-04/schema#/properties/title"
|
||||
|
|
@ -1552,7 +1552,7 @@
|
|||
"description": {
|
||||
"$ref": "http://json-schema.org/draft-04/schema#/properties/description"
|
||||
},
|
||||
"default": {
|
||||
(resource.DefaultNamespace): {
|
||||
"$ref": "http://json-schema.org/draft-04/schema#/properties/default"
|
||||
},
|
||||
"multipleOf": {
|
||||
|
|
@ -1607,4 +1607,4 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +1,34 @@
|
|||
package runewidth
|
||||
|
||||
import "os"
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
var (
|
||||
// EastAsianWidth will be set true if the current locale is CJK
|
||||
EastAsianWidth bool
|
||||
|
||||
// ZeroWidthJoiner is flag to set to use UTR#51 ZWJ
|
||||
ZeroWidthJoiner bool
|
||||
|
||||
// DefaultCondition is a condition in current locale
|
||||
DefaultCondition = &Condition{EastAsianWidth}
|
||||
DefaultCondition = &Condition{}
|
||||
)
|
||||
|
||||
func init() {
|
||||
handleEnv()
|
||||
}
|
||||
|
||||
func handleEnv() {
|
||||
env := os.Getenv("RUNEWIDTH_EASTASIAN")
|
||||
if env == "" {
|
||||
EastAsianWidth = IsEastAsian()
|
||||
} else {
|
||||
EastAsianWidth = env == "1"
|
||||
}
|
||||
// update DefaultCondition
|
||||
DefaultCondition.EastAsianWidth = EastAsianWidth
|
||||
DefaultCondition.ZeroWidthJoiner = ZeroWidthJoiner
|
||||
}
|
||||
|
||||
type interval struct {
|
||||
|
|
@ -44,7 +56,7 @@ func inTable(r rune, t table) bool {
|
|||
bot := 0
|
||||
top := len(t) - 1
|
||||
for top >= bot {
|
||||
mid := (bot + top) / 2
|
||||
mid := (bot + top) >> 1
|
||||
|
||||
switch {
|
||||
case t[mid].last < r:
|
||||
|
|
@ -66,8 +78,7 @@ var private = table{
|
|||
var nonprint = table{
|
||||
{0x0000, 0x001F}, {0x007F, 0x009F}, {0x00AD, 0x00AD},
|
||||
{0x070F, 0x070F}, {0x180B, 0x180E}, {0x200B, 0x200F},
|
||||
{0x2028, 0x2029},
|
||||
{0x202A, 0x202E}, {0x206A, 0x206F}, {0xD800, 0xDFFF},
|
||||
{0x2028, 0x202E}, {0x206A, 0x206F}, {0xD800, 0xDFFF},
|
||||
{0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFB}, {0xFFFE, 0xFFFF},
|
||||
}
|
||||
|
||||
|
|
@ -261,19 +272,54 @@ var ambiguous = table{
|
|||
}
|
||||
|
||||
var emoji = table{
|
||||
{0x1F1E6, 0x1F1FF}, {0x1F321, 0x1F321}, {0x1F324, 0x1F32C},
|
||||
{0x1F336, 0x1F336}, {0x1F37D, 0x1F37D}, {0x1F396, 0x1F397},
|
||||
{0x1F399, 0x1F39B}, {0x1F39E, 0x1F39F}, {0x1F3CB, 0x1F3CE},
|
||||
{0x1F3D4, 0x1F3DF}, {0x1F3F3, 0x1F3F5}, {0x1F3F7, 0x1F3F7},
|
||||
{0x1F43F, 0x1F43F}, {0x1F441, 0x1F441}, {0x1F4FD, 0x1F4FD},
|
||||
{0x1F549, 0x1F54A}, {0x1F56F, 0x1F570}, {0x1F573, 0x1F579},
|
||||
{0x203C, 0x203C}, {0x2049, 0x2049}, {0x2122, 0x2122},
|
||||
{0x2139, 0x2139}, {0x2194, 0x2199}, {0x21A9, 0x21AA},
|
||||
{0x231A, 0x231B}, {0x2328, 0x2328}, {0x23CF, 0x23CF},
|
||||
{0x23E9, 0x23F3}, {0x23F8, 0x23FA}, {0x24C2, 0x24C2},
|
||||
{0x25AA, 0x25AB}, {0x25B6, 0x25B6}, {0x25C0, 0x25C0},
|
||||
{0x25FB, 0x25FE}, {0x2600, 0x2604}, {0x260E, 0x260E},
|
||||
{0x2611, 0x2611}, {0x2614, 0x2615}, {0x2618, 0x2618},
|
||||
{0x261D, 0x261D}, {0x2620, 0x2620}, {0x2622, 0x2623},
|
||||
{0x2626, 0x2626}, {0x262A, 0x262A}, {0x262E, 0x262F},
|
||||
{0x2638, 0x263A}, {0x2640, 0x2640}, {0x2642, 0x2642},
|
||||
{0x2648, 0x2653}, {0x265F, 0x2660}, {0x2663, 0x2663},
|
||||
{0x2665, 0x2666}, {0x2668, 0x2668}, {0x267B, 0x267B},
|
||||
{0x267E, 0x267F}, {0x2692, 0x2697}, {0x2699, 0x2699},
|
||||
{0x269B, 0x269C}, {0x26A0, 0x26A1}, {0x26AA, 0x26AB},
|
||||
{0x26B0, 0x26B1}, {0x26BD, 0x26BE}, {0x26C4, 0x26C5},
|
||||
{0x26C8, 0x26C8}, {0x26CE, 0x26CF}, {0x26D1, 0x26D1},
|
||||
{0x26D3, 0x26D4}, {0x26E9, 0x26EA}, {0x26F0, 0x26F5},
|
||||
{0x26F7, 0x26FA}, {0x26FD, 0x26FD}, {0x2702, 0x2702},
|
||||
{0x2705, 0x2705}, {0x2708, 0x270D}, {0x270F, 0x270F},
|
||||
{0x2712, 0x2712}, {0x2714, 0x2714}, {0x2716, 0x2716},
|
||||
{0x271D, 0x271D}, {0x2721, 0x2721}, {0x2728, 0x2728},
|
||||
{0x2733, 0x2734}, {0x2744, 0x2744}, {0x2747, 0x2747},
|
||||
{0x274C, 0x274C}, {0x274E, 0x274E}, {0x2753, 0x2755},
|
||||
{0x2757, 0x2757}, {0x2763, 0x2764}, {0x2795, 0x2797},
|
||||
{0x27A1, 0x27A1}, {0x27B0, 0x27B0}, {0x27BF, 0x27BF},
|
||||
{0x2934, 0x2935}, {0x2B05, 0x2B07}, {0x2B1B, 0x2B1C},
|
||||
{0x2B50, 0x2B50}, {0x2B55, 0x2B55}, {0x3030, 0x3030},
|
||||
{0x303D, 0x303D}, {0x3297, 0x3297}, {0x3299, 0x3299},
|
||||
{0x1F004, 0x1F004}, {0x1F0CF, 0x1F0CF}, {0x1F170, 0x1F171},
|
||||
{0x1F17E, 0x1F17F}, {0x1F18E, 0x1F18E}, {0x1F191, 0x1F19A},
|
||||
{0x1F1E6, 0x1F1FF}, {0x1F201, 0x1F202}, {0x1F21A, 0x1F21A},
|
||||
{0x1F22F, 0x1F22F}, {0x1F232, 0x1F23A}, {0x1F250, 0x1F251},
|
||||
{0x1F300, 0x1F321}, {0x1F324, 0x1F393}, {0x1F396, 0x1F397},
|
||||
{0x1F399, 0x1F39B}, {0x1F39E, 0x1F3F0}, {0x1F3F3, 0x1F3F5},
|
||||
{0x1F3F7, 0x1F4FD}, {0x1F4FF, 0x1F53D}, {0x1F549, 0x1F54E},
|
||||
{0x1F550, 0x1F567}, {0x1F56F, 0x1F570}, {0x1F573, 0x1F57A},
|
||||
{0x1F587, 0x1F587}, {0x1F58A, 0x1F58D}, {0x1F590, 0x1F590},
|
||||
{0x1F5A5, 0x1F5A5}, {0x1F5A8, 0x1F5A8}, {0x1F5B1, 0x1F5B2},
|
||||
{0x1F5BC, 0x1F5BC}, {0x1F5C2, 0x1F5C4}, {0x1F5D1, 0x1F5D3},
|
||||
{0x1F5DC, 0x1F5DE}, {0x1F5E1, 0x1F5E1}, {0x1F5E3, 0x1F5E3},
|
||||
{0x1F5E8, 0x1F5E8}, {0x1F5EF, 0x1F5EF}, {0x1F5F3, 0x1F5F3},
|
||||
{0x1F5FA, 0x1F5FA}, {0x1F6CB, 0x1F6CF}, {0x1F6E0, 0x1F6E5},
|
||||
{0x1F6E9, 0x1F6E9}, {0x1F6F0, 0x1F6F0}, {0x1F6F3, 0x1F6F3},
|
||||
{0x1F595, 0x1F596}, {0x1F5A4, 0x1F5A5}, {0x1F5A8, 0x1F5A8},
|
||||
{0x1F5B1, 0x1F5B2}, {0x1F5BC, 0x1F5BC}, {0x1F5C2, 0x1F5C4},
|
||||
{0x1F5D1, 0x1F5D3}, {0x1F5DC, 0x1F5DE}, {0x1F5E1, 0x1F5E1},
|
||||
{0x1F5E3, 0x1F5E3}, {0x1F5E8, 0x1F5E8}, {0x1F5EF, 0x1F5EF},
|
||||
{0x1F5F3, 0x1F5F3}, {0x1F5FA, 0x1F64F}, {0x1F680, 0x1F6C5},
|
||||
{0x1F6CB, 0x1F6D2}, {0x1F6E0, 0x1F6E5}, {0x1F6E9, 0x1F6E9},
|
||||
{0x1F6EB, 0x1F6EC}, {0x1F6F0, 0x1F6F0}, {0x1F6F3, 0x1F6F9},
|
||||
{0x1F910, 0x1F93A}, {0x1F93C, 0x1F93E}, {0x1F940, 0x1F945},
|
||||
{0x1F947, 0x1F970}, {0x1F973, 0x1F976}, {0x1F97A, 0x1F97A},
|
||||
{0x1F97C, 0x1F9A2}, {0x1F9B0, 0x1F9B9}, {0x1F9C0, 0x1F9C2},
|
||||
{0x1F9D0, 0x1F9FF},
|
||||
}
|
||||
|
||||
var notassigned = table{
|
||||
|
|
@ -493,314 +539,141 @@ var notassigned = table{
|
|||
}
|
||||
|
||||
var neutral = table{
|
||||
{0x0000, 0x001F}, {0x007F, 0x007F}, {0x0080, 0x009F},
|
||||
{0x00A0, 0x00A0}, {0x00A9, 0x00A9}, {0x00AB, 0x00AB},
|
||||
{0x00B5, 0x00B5}, {0x00BB, 0x00BB}, {0x00C0, 0x00C5},
|
||||
{0x00C7, 0x00CF}, {0x00D1, 0x00D6}, {0x00D9, 0x00DD},
|
||||
{0x00E2, 0x00E5}, {0x00E7, 0x00E7}, {0x00EB, 0x00EB},
|
||||
{0x00EE, 0x00EF}, {0x00F1, 0x00F1}, {0x00F4, 0x00F6},
|
||||
{0x00FB, 0x00FB}, {0x00FD, 0x00FD}, {0x00FF, 0x00FF},
|
||||
{0x0100, 0x0100}, {0x0102, 0x0110}, {0x0112, 0x0112},
|
||||
{0x0000, 0x001F}, {0x007F, 0x00A0}, {0x00A9, 0x00A9},
|
||||
{0x00AB, 0x00AB}, {0x00B5, 0x00B5}, {0x00BB, 0x00BB},
|
||||
{0x00C0, 0x00C5}, {0x00C7, 0x00CF}, {0x00D1, 0x00D6},
|
||||
{0x00D9, 0x00DD}, {0x00E2, 0x00E5}, {0x00E7, 0x00E7},
|
||||
{0x00EB, 0x00EB}, {0x00EE, 0x00EF}, {0x00F1, 0x00F1},
|
||||
{0x00F4, 0x00F6}, {0x00FB, 0x00FB}, {0x00FD, 0x00FD},
|
||||
{0x00FF, 0x0100}, {0x0102, 0x0110}, {0x0112, 0x0112},
|
||||
{0x0114, 0x011A}, {0x011C, 0x0125}, {0x0128, 0x012A},
|
||||
{0x012C, 0x0130}, {0x0134, 0x0137}, {0x0139, 0x013E},
|
||||
{0x0143, 0x0143}, {0x0145, 0x0147}, {0x014C, 0x014C},
|
||||
{0x014E, 0x0151}, {0x0154, 0x0165}, {0x0168, 0x016A},
|
||||
{0x016C, 0x017F}, {0x0180, 0x01BA}, {0x01BB, 0x01BB},
|
||||
{0x01BC, 0x01BF}, {0x01C0, 0x01C3}, {0x01C4, 0x01CD},
|
||||
{0x01CF, 0x01CF}, {0x01D1, 0x01D1}, {0x01D3, 0x01D3},
|
||||
{0x01D5, 0x01D5}, {0x01D7, 0x01D7}, {0x01D9, 0x01D9},
|
||||
{0x01DB, 0x01DB}, {0x01DD, 0x024F}, {0x0250, 0x0250},
|
||||
{0x0252, 0x0260}, {0x0262, 0x0293}, {0x0294, 0x0294},
|
||||
{0x0295, 0x02AF}, {0x02B0, 0x02C1}, {0x02C2, 0x02C3},
|
||||
{0x02C5, 0x02C5}, {0x02C6, 0x02C6}, {0x02C8, 0x02C8},
|
||||
{0x02CC, 0x02CC}, {0x02CE, 0x02CF}, {0x02D1, 0x02D1},
|
||||
{0x02D2, 0x02D7}, {0x02DC, 0x02DC}, {0x02DE, 0x02DE},
|
||||
{0x02E0, 0x02E4}, {0x02E5, 0x02EB}, {0x02EC, 0x02EC},
|
||||
{0x02ED, 0x02ED}, {0x02EE, 0x02EE}, {0x02EF, 0x02FF},
|
||||
{0x0370, 0x0373}, {0x0374, 0x0374}, {0x0375, 0x0375},
|
||||
{0x0376, 0x0377}, {0x037A, 0x037A}, {0x037B, 0x037D},
|
||||
{0x037E, 0x037E}, {0x037F, 0x037F}, {0x0384, 0x0385},
|
||||
{0x0386, 0x0386}, {0x0387, 0x0387}, {0x0388, 0x038A},
|
||||
{0x038C, 0x038C}, {0x038E, 0x0390}, {0x03AA, 0x03B0},
|
||||
{0x03C2, 0x03C2}, {0x03CA, 0x03F5}, {0x03F6, 0x03F6},
|
||||
{0x03F7, 0x03FF}, {0x0400, 0x0400}, {0x0402, 0x040F},
|
||||
{0x0450, 0x0450}, {0x0452, 0x0481}, {0x0482, 0x0482},
|
||||
{0x0483, 0x0487}, {0x0488, 0x0489}, {0x048A, 0x04FF},
|
||||
{0x0500, 0x052F}, {0x0531, 0x0556}, {0x0559, 0x0559},
|
||||
{0x055A, 0x055F}, {0x0561, 0x0587}, {0x0589, 0x0589},
|
||||
{0x058A, 0x058A}, {0x058D, 0x058E}, {0x058F, 0x058F},
|
||||
{0x0591, 0x05BD}, {0x05BE, 0x05BE}, {0x05BF, 0x05BF},
|
||||
{0x05C0, 0x05C0}, {0x05C1, 0x05C2}, {0x05C3, 0x05C3},
|
||||
{0x05C4, 0x05C5}, {0x05C6, 0x05C6}, {0x05C7, 0x05C7},
|
||||
{0x05D0, 0x05EA}, {0x05F0, 0x05F2}, {0x05F3, 0x05F4},
|
||||
{0x0600, 0x0605}, {0x0606, 0x0608}, {0x0609, 0x060A},
|
||||
{0x060B, 0x060B}, {0x060C, 0x060D}, {0x060E, 0x060F},
|
||||
{0x0610, 0x061A}, {0x061B, 0x061B}, {0x061C, 0x061C},
|
||||
{0x061E, 0x061F}, {0x0620, 0x063F}, {0x0640, 0x0640},
|
||||
{0x0641, 0x064A}, {0x064B, 0x065F}, {0x0660, 0x0669},
|
||||
{0x066A, 0x066D}, {0x066E, 0x066F}, {0x0670, 0x0670},
|
||||
{0x0671, 0x06D3}, {0x06D4, 0x06D4}, {0x06D5, 0x06D5},
|
||||
{0x06D6, 0x06DC}, {0x06DD, 0x06DD}, {0x06DE, 0x06DE},
|
||||
{0x06DF, 0x06E4}, {0x06E5, 0x06E6}, {0x06E7, 0x06E8},
|
||||
{0x06E9, 0x06E9}, {0x06EA, 0x06ED}, {0x06EE, 0x06EF},
|
||||
{0x06F0, 0x06F9}, {0x06FA, 0x06FC}, {0x06FD, 0x06FE},
|
||||
{0x06FF, 0x06FF}, {0x0700, 0x070D}, {0x070F, 0x070F},
|
||||
{0x0710, 0x0710}, {0x0711, 0x0711}, {0x0712, 0x072F},
|
||||
{0x0730, 0x074A}, {0x074D, 0x074F}, {0x0750, 0x077F},
|
||||
{0x0780, 0x07A5}, {0x07A6, 0x07B0}, {0x07B1, 0x07B1},
|
||||
{0x07C0, 0x07C9}, {0x07CA, 0x07EA}, {0x07EB, 0x07F3},
|
||||
{0x07F4, 0x07F5}, {0x07F6, 0x07F6}, {0x07F7, 0x07F9},
|
||||
{0x07FA, 0x07FA}, {0x0800, 0x0815}, {0x0816, 0x0819},
|
||||
{0x081A, 0x081A}, {0x081B, 0x0823}, {0x0824, 0x0824},
|
||||
{0x0825, 0x0827}, {0x0828, 0x0828}, {0x0829, 0x082D},
|
||||
{0x0830, 0x083E}, {0x0840, 0x0858}, {0x0859, 0x085B},
|
||||
{0x085E, 0x085E}, {0x08A0, 0x08B4}, {0x08B6, 0x08BD},
|
||||
{0x08D4, 0x08E1}, {0x08E2, 0x08E2}, {0x08E3, 0x08FF},
|
||||
{0x0900, 0x0902}, {0x0903, 0x0903}, {0x0904, 0x0939},
|
||||
{0x093A, 0x093A}, {0x093B, 0x093B}, {0x093C, 0x093C},
|
||||
{0x093D, 0x093D}, {0x093E, 0x0940}, {0x0941, 0x0948},
|
||||
{0x0949, 0x094C}, {0x094D, 0x094D}, {0x094E, 0x094F},
|
||||
{0x0950, 0x0950}, {0x0951, 0x0957}, {0x0958, 0x0961},
|
||||
{0x0962, 0x0963}, {0x0964, 0x0965}, {0x0966, 0x096F},
|
||||
{0x0970, 0x0970}, {0x0971, 0x0971}, {0x0972, 0x097F},
|
||||
{0x0980, 0x0980}, {0x0981, 0x0981}, {0x0982, 0x0983},
|
||||
{0x0985, 0x098C}, {0x098F, 0x0990}, {0x0993, 0x09A8},
|
||||
{0x09AA, 0x09B0}, {0x09B2, 0x09B2}, {0x09B6, 0x09B9},
|
||||
{0x09BC, 0x09BC}, {0x09BD, 0x09BD}, {0x09BE, 0x09C0},
|
||||
{0x09C1, 0x09C4}, {0x09C7, 0x09C8}, {0x09CB, 0x09CC},
|
||||
{0x09CD, 0x09CD}, {0x09CE, 0x09CE}, {0x09D7, 0x09D7},
|
||||
{0x09DC, 0x09DD}, {0x09DF, 0x09E1}, {0x09E2, 0x09E3},
|
||||
{0x09E6, 0x09EF}, {0x09F0, 0x09F1}, {0x09F2, 0x09F3},
|
||||
{0x09F4, 0x09F9}, {0x09FA, 0x09FA}, {0x09FB, 0x09FB},
|
||||
{0x0A01, 0x0A02}, {0x0A03, 0x0A03}, {0x0A05, 0x0A0A},
|
||||
{0x0A0F, 0x0A10}, {0x0A13, 0x0A28}, {0x0A2A, 0x0A30},
|
||||
{0x0A32, 0x0A33}, {0x0A35, 0x0A36}, {0x0A38, 0x0A39},
|
||||
{0x0A3C, 0x0A3C}, {0x0A3E, 0x0A40}, {0x0A41, 0x0A42},
|
||||
{0x0A47, 0x0A48}, {0x0A4B, 0x0A4D}, {0x0A51, 0x0A51},
|
||||
{0x0A59, 0x0A5C}, {0x0A5E, 0x0A5E}, {0x0A66, 0x0A6F},
|
||||
{0x0A70, 0x0A71}, {0x0A72, 0x0A74}, {0x0A75, 0x0A75},
|
||||
{0x0A81, 0x0A82}, {0x0A83, 0x0A83}, {0x0A85, 0x0A8D},
|
||||
{0x016C, 0x01CD}, {0x01CF, 0x01CF}, {0x01D1, 0x01D1},
|
||||
{0x01D3, 0x01D3}, {0x01D5, 0x01D5}, {0x01D7, 0x01D7},
|
||||
{0x01D9, 0x01D9}, {0x01DB, 0x01DB}, {0x01DD, 0x0250},
|
||||
{0x0252, 0x0260}, {0x0262, 0x02C3}, {0x02C5, 0x02C6},
|
||||
{0x02C8, 0x02C8}, {0x02CC, 0x02CC}, {0x02CE, 0x02CF},
|
||||
{0x02D1, 0x02D7}, {0x02DC, 0x02DC}, {0x02DE, 0x02DE},
|
||||
{0x02E0, 0x02FF}, {0x0370, 0x0377}, {0x037A, 0x037F},
|
||||
{0x0384, 0x038A}, {0x038C, 0x038C}, {0x038E, 0x0390},
|
||||
{0x03AA, 0x03B0}, {0x03C2, 0x03C2}, {0x03CA, 0x0400},
|
||||
{0x0402, 0x040F}, {0x0450, 0x0450}, {0x0452, 0x052F},
|
||||
{0x0531, 0x0556}, {0x0559, 0x055F}, {0x0561, 0x0587},
|
||||
{0x0589, 0x058A}, {0x058D, 0x058F}, {0x0591, 0x05C7},
|
||||
{0x05D0, 0x05EA}, {0x05F0, 0x05F4}, {0x0600, 0x061C},
|
||||
{0x061E, 0x070D}, {0x070F, 0x074A}, {0x074D, 0x07B1},
|
||||
{0x07C0, 0x07FA}, {0x0800, 0x082D}, {0x0830, 0x083E},
|
||||
{0x0840, 0x085B}, {0x085E, 0x085E}, {0x08A0, 0x08B4},
|
||||
{0x08B6, 0x08BD}, {0x08D4, 0x0983}, {0x0985, 0x098C},
|
||||
{0x098F, 0x0990}, {0x0993, 0x09A8}, {0x09AA, 0x09B0},
|
||||
{0x09B2, 0x09B2}, {0x09B6, 0x09B9}, {0x09BC, 0x09C4},
|
||||
{0x09C7, 0x09C8}, {0x09CB, 0x09CE}, {0x09D7, 0x09D7},
|
||||
{0x09DC, 0x09DD}, {0x09DF, 0x09E3}, {0x09E6, 0x09FB},
|
||||
{0x0A01, 0x0A03}, {0x0A05, 0x0A0A}, {0x0A0F, 0x0A10},
|
||||
{0x0A13, 0x0A28}, {0x0A2A, 0x0A30}, {0x0A32, 0x0A33},
|
||||
{0x0A35, 0x0A36}, {0x0A38, 0x0A39}, {0x0A3C, 0x0A3C},
|
||||
{0x0A3E, 0x0A42}, {0x0A47, 0x0A48}, {0x0A4B, 0x0A4D},
|
||||
{0x0A51, 0x0A51}, {0x0A59, 0x0A5C}, {0x0A5E, 0x0A5E},
|
||||
{0x0A66, 0x0A75}, {0x0A81, 0x0A83}, {0x0A85, 0x0A8D},
|
||||
{0x0A8F, 0x0A91}, {0x0A93, 0x0AA8}, {0x0AAA, 0x0AB0},
|
||||
{0x0AB2, 0x0AB3}, {0x0AB5, 0x0AB9}, {0x0ABC, 0x0ABC},
|
||||
{0x0ABD, 0x0ABD}, {0x0ABE, 0x0AC0}, {0x0AC1, 0x0AC5},
|
||||
{0x0AC7, 0x0AC8}, {0x0AC9, 0x0AC9}, {0x0ACB, 0x0ACC},
|
||||
{0x0ACD, 0x0ACD}, {0x0AD0, 0x0AD0}, {0x0AE0, 0x0AE1},
|
||||
{0x0AE2, 0x0AE3}, {0x0AE6, 0x0AEF}, {0x0AF0, 0x0AF0},
|
||||
{0x0AF1, 0x0AF1}, {0x0AF9, 0x0AF9}, {0x0B01, 0x0B01},
|
||||
{0x0B02, 0x0B03}, {0x0B05, 0x0B0C}, {0x0B0F, 0x0B10},
|
||||
{0x0AB2, 0x0AB3}, {0x0AB5, 0x0AB9}, {0x0ABC, 0x0AC5},
|
||||
{0x0AC7, 0x0AC9}, {0x0ACB, 0x0ACD}, {0x0AD0, 0x0AD0},
|
||||
{0x0AE0, 0x0AE3}, {0x0AE6, 0x0AF1}, {0x0AF9, 0x0AF9},
|
||||
{0x0B01, 0x0B03}, {0x0B05, 0x0B0C}, {0x0B0F, 0x0B10},
|
||||
{0x0B13, 0x0B28}, {0x0B2A, 0x0B30}, {0x0B32, 0x0B33},
|
||||
{0x0B35, 0x0B39}, {0x0B3C, 0x0B3C}, {0x0B3D, 0x0B3D},
|
||||
{0x0B3E, 0x0B3E}, {0x0B3F, 0x0B3F}, {0x0B40, 0x0B40},
|
||||
{0x0B41, 0x0B44}, {0x0B47, 0x0B48}, {0x0B4B, 0x0B4C},
|
||||
{0x0B4D, 0x0B4D}, {0x0B56, 0x0B56}, {0x0B57, 0x0B57},
|
||||
{0x0B5C, 0x0B5D}, {0x0B5F, 0x0B61}, {0x0B62, 0x0B63},
|
||||
{0x0B66, 0x0B6F}, {0x0B70, 0x0B70}, {0x0B71, 0x0B71},
|
||||
{0x0B72, 0x0B77}, {0x0B82, 0x0B82}, {0x0B83, 0x0B83},
|
||||
{0x0B35, 0x0B39}, {0x0B3C, 0x0B44}, {0x0B47, 0x0B48},
|
||||
{0x0B4B, 0x0B4D}, {0x0B56, 0x0B57}, {0x0B5C, 0x0B5D},
|
||||
{0x0B5F, 0x0B63}, {0x0B66, 0x0B77}, {0x0B82, 0x0B83},
|
||||
{0x0B85, 0x0B8A}, {0x0B8E, 0x0B90}, {0x0B92, 0x0B95},
|
||||
{0x0B99, 0x0B9A}, {0x0B9C, 0x0B9C}, {0x0B9E, 0x0B9F},
|
||||
{0x0BA3, 0x0BA4}, {0x0BA8, 0x0BAA}, {0x0BAE, 0x0BB9},
|
||||
{0x0BBE, 0x0BBF}, {0x0BC0, 0x0BC0}, {0x0BC1, 0x0BC2},
|
||||
{0x0BC6, 0x0BC8}, {0x0BCA, 0x0BCC}, {0x0BCD, 0x0BCD},
|
||||
{0x0BD0, 0x0BD0}, {0x0BD7, 0x0BD7}, {0x0BE6, 0x0BEF},
|
||||
{0x0BF0, 0x0BF2}, {0x0BF3, 0x0BF8}, {0x0BF9, 0x0BF9},
|
||||
{0x0BFA, 0x0BFA}, {0x0C00, 0x0C00}, {0x0C01, 0x0C03},
|
||||
{0x0C05, 0x0C0C}, {0x0C0E, 0x0C10}, {0x0C12, 0x0C28},
|
||||
{0x0C2A, 0x0C39}, {0x0C3D, 0x0C3D}, {0x0C3E, 0x0C40},
|
||||
{0x0C41, 0x0C44}, {0x0C46, 0x0C48}, {0x0C4A, 0x0C4D},
|
||||
{0x0C55, 0x0C56}, {0x0C58, 0x0C5A}, {0x0C60, 0x0C61},
|
||||
{0x0C62, 0x0C63}, {0x0C66, 0x0C6F}, {0x0C78, 0x0C7E},
|
||||
{0x0C7F, 0x0C7F}, {0x0C80, 0x0C80}, {0x0C81, 0x0C81},
|
||||
{0x0C82, 0x0C83}, {0x0C85, 0x0C8C}, {0x0C8E, 0x0C90},
|
||||
{0x0BBE, 0x0BC2}, {0x0BC6, 0x0BC8}, {0x0BCA, 0x0BCD},
|
||||
{0x0BD0, 0x0BD0}, {0x0BD7, 0x0BD7}, {0x0BE6, 0x0BFA},
|
||||
{0x0C00, 0x0C03}, {0x0C05, 0x0C0C}, {0x0C0E, 0x0C10},
|
||||
{0x0C12, 0x0C28}, {0x0C2A, 0x0C39}, {0x0C3D, 0x0C44},
|
||||
{0x0C46, 0x0C48}, {0x0C4A, 0x0C4D}, {0x0C55, 0x0C56},
|
||||
{0x0C58, 0x0C5A}, {0x0C60, 0x0C63}, {0x0C66, 0x0C6F},
|
||||
{0x0C78, 0x0C83}, {0x0C85, 0x0C8C}, {0x0C8E, 0x0C90},
|
||||
{0x0C92, 0x0CA8}, {0x0CAA, 0x0CB3}, {0x0CB5, 0x0CB9},
|
||||
{0x0CBC, 0x0CBC}, {0x0CBD, 0x0CBD}, {0x0CBE, 0x0CBE},
|
||||
{0x0CBF, 0x0CBF}, {0x0CC0, 0x0CC4}, {0x0CC6, 0x0CC6},
|
||||
{0x0CC7, 0x0CC8}, {0x0CCA, 0x0CCB}, {0x0CCC, 0x0CCD},
|
||||
{0x0CD5, 0x0CD6}, {0x0CDE, 0x0CDE}, {0x0CE0, 0x0CE1},
|
||||
{0x0CE2, 0x0CE3}, {0x0CE6, 0x0CEF}, {0x0CF1, 0x0CF2},
|
||||
{0x0D01, 0x0D01}, {0x0D02, 0x0D03}, {0x0D05, 0x0D0C},
|
||||
{0x0D0E, 0x0D10}, {0x0D12, 0x0D3A}, {0x0D3D, 0x0D3D},
|
||||
{0x0D3E, 0x0D40}, {0x0D41, 0x0D44}, {0x0D46, 0x0D48},
|
||||
{0x0D4A, 0x0D4C}, {0x0D4D, 0x0D4D}, {0x0D4E, 0x0D4E},
|
||||
{0x0D4F, 0x0D4F}, {0x0D54, 0x0D56}, {0x0D57, 0x0D57},
|
||||
{0x0D58, 0x0D5E}, {0x0D5F, 0x0D61}, {0x0D62, 0x0D63},
|
||||
{0x0D66, 0x0D6F}, {0x0D70, 0x0D78}, {0x0D79, 0x0D79},
|
||||
{0x0D7A, 0x0D7F}, {0x0D82, 0x0D83}, {0x0D85, 0x0D96},
|
||||
{0x0D9A, 0x0DB1}, {0x0DB3, 0x0DBB}, {0x0DBD, 0x0DBD},
|
||||
{0x0DC0, 0x0DC6}, {0x0DCA, 0x0DCA}, {0x0DCF, 0x0DD1},
|
||||
{0x0DD2, 0x0DD4}, {0x0DD6, 0x0DD6}, {0x0DD8, 0x0DDF},
|
||||
{0x0DE6, 0x0DEF}, {0x0DF2, 0x0DF3}, {0x0DF4, 0x0DF4},
|
||||
{0x0E01, 0x0E30}, {0x0E31, 0x0E31}, {0x0E32, 0x0E33},
|
||||
{0x0E34, 0x0E3A}, {0x0E3F, 0x0E3F}, {0x0E40, 0x0E45},
|
||||
{0x0E46, 0x0E46}, {0x0E47, 0x0E4E}, {0x0E4F, 0x0E4F},
|
||||
{0x0E50, 0x0E59}, {0x0E5A, 0x0E5B}, {0x0E81, 0x0E82},
|
||||
{0x0E84, 0x0E84}, {0x0E87, 0x0E88}, {0x0E8A, 0x0E8A},
|
||||
{0x0E8D, 0x0E8D}, {0x0E94, 0x0E97}, {0x0E99, 0x0E9F},
|
||||
{0x0EA1, 0x0EA3}, {0x0EA5, 0x0EA5}, {0x0EA7, 0x0EA7},
|
||||
{0x0EAA, 0x0EAB}, {0x0EAD, 0x0EB0}, {0x0EB1, 0x0EB1},
|
||||
{0x0EB2, 0x0EB3}, {0x0EB4, 0x0EB9}, {0x0EBB, 0x0EBC},
|
||||
{0x0EBD, 0x0EBD}, {0x0EC0, 0x0EC4}, {0x0EC6, 0x0EC6},
|
||||
{0x0EC8, 0x0ECD}, {0x0ED0, 0x0ED9}, {0x0EDC, 0x0EDF},
|
||||
{0x0F00, 0x0F00}, {0x0F01, 0x0F03}, {0x0F04, 0x0F12},
|
||||
{0x0F13, 0x0F13}, {0x0F14, 0x0F14}, {0x0F15, 0x0F17},
|
||||
{0x0F18, 0x0F19}, {0x0F1A, 0x0F1F}, {0x0F20, 0x0F29},
|
||||
{0x0F2A, 0x0F33}, {0x0F34, 0x0F34}, {0x0F35, 0x0F35},
|
||||
{0x0F36, 0x0F36}, {0x0F37, 0x0F37}, {0x0F38, 0x0F38},
|
||||
{0x0F39, 0x0F39}, {0x0F3A, 0x0F3A}, {0x0F3B, 0x0F3B},
|
||||
{0x0F3C, 0x0F3C}, {0x0F3D, 0x0F3D}, {0x0F3E, 0x0F3F},
|
||||
{0x0F40, 0x0F47}, {0x0F49, 0x0F6C}, {0x0F71, 0x0F7E},
|
||||
{0x0F7F, 0x0F7F}, {0x0F80, 0x0F84}, {0x0F85, 0x0F85},
|
||||
{0x0F86, 0x0F87}, {0x0F88, 0x0F8C}, {0x0F8D, 0x0F97},
|
||||
{0x0F99, 0x0FBC}, {0x0FBE, 0x0FC5}, {0x0FC6, 0x0FC6},
|
||||
{0x0FC7, 0x0FCC}, {0x0FCE, 0x0FCF}, {0x0FD0, 0x0FD4},
|
||||
{0x0FD5, 0x0FD8}, {0x0FD9, 0x0FDA}, {0x1000, 0x102A},
|
||||
{0x102B, 0x102C}, {0x102D, 0x1030}, {0x1031, 0x1031},
|
||||
{0x1032, 0x1037}, {0x1038, 0x1038}, {0x1039, 0x103A},
|
||||
{0x103B, 0x103C}, {0x103D, 0x103E}, {0x103F, 0x103F},
|
||||
{0x1040, 0x1049}, {0x104A, 0x104F}, {0x1050, 0x1055},
|
||||
{0x1056, 0x1057}, {0x1058, 0x1059}, {0x105A, 0x105D},
|
||||
{0x105E, 0x1060}, {0x1061, 0x1061}, {0x1062, 0x1064},
|
||||
{0x1065, 0x1066}, {0x1067, 0x106D}, {0x106E, 0x1070},
|
||||
{0x1071, 0x1074}, {0x1075, 0x1081}, {0x1082, 0x1082},
|
||||
{0x1083, 0x1084}, {0x1085, 0x1086}, {0x1087, 0x108C},
|
||||
{0x108D, 0x108D}, {0x108E, 0x108E}, {0x108F, 0x108F},
|
||||
{0x1090, 0x1099}, {0x109A, 0x109C}, {0x109D, 0x109D},
|
||||
{0x109E, 0x109F}, {0x10A0, 0x10C5}, {0x10C7, 0x10C7},
|
||||
{0x10CD, 0x10CD}, {0x10D0, 0x10FA}, {0x10FB, 0x10FB},
|
||||
{0x10FC, 0x10FC}, {0x10FD, 0x10FF}, {0x1160, 0x11FF},
|
||||
{0x1200, 0x1248}, {0x124A, 0x124D}, {0x1250, 0x1256},
|
||||
{0x1258, 0x1258}, {0x125A, 0x125D}, {0x1260, 0x1288},
|
||||
{0x128A, 0x128D}, {0x1290, 0x12B0}, {0x12B2, 0x12B5},
|
||||
{0x12B8, 0x12BE}, {0x12C0, 0x12C0}, {0x12C2, 0x12C5},
|
||||
{0x12C8, 0x12D6}, {0x12D8, 0x1310}, {0x1312, 0x1315},
|
||||
{0x1318, 0x135A}, {0x135D, 0x135F}, {0x1360, 0x1368},
|
||||
{0x1369, 0x137C}, {0x1380, 0x138F}, {0x1390, 0x1399},
|
||||
{0x13A0, 0x13F5}, {0x13F8, 0x13FD}, {0x1400, 0x1400},
|
||||
{0x1401, 0x166C}, {0x166D, 0x166E}, {0x166F, 0x167F},
|
||||
{0x1680, 0x1680}, {0x1681, 0x169A}, {0x169B, 0x169B},
|
||||
{0x169C, 0x169C}, {0x16A0, 0x16EA}, {0x16EB, 0x16ED},
|
||||
{0x16EE, 0x16F0}, {0x16F1, 0x16F8}, {0x1700, 0x170C},
|
||||
{0x170E, 0x1711}, {0x1712, 0x1714}, {0x1720, 0x1731},
|
||||
{0x1732, 0x1734}, {0x1735, 0x1736}, {0x1740, 0x1751},
|
||||
{0x1752, 0x1753}, {0x1760, 0x176C}, {0x176E, 0x1770},
|
||||
{0x1772, 0x1773}, {0x1780, 0x17B3}, {0x17B4, 0x17B5},
|
||||
{0x17B6, 0x17B6}, {0x17B7, 0x17BD}, {0x17BE, 0x17C5},
|
||||
{0x17C6, 0x17C6}, {0x17C7, 0x17C8}, {0x17C9, 0x17D3},
|
||||
{0x17D4, 0x17D6}, {0x17D7, 0x17D7}, {0x17D8, 0x17DA},
|
||||
{0x17DB, 0x17DB}, {0x17DC, 0x17DC}, {0x17DD, 0x17DD},
|
||||
{0x17E0, 0x17E9}, {0x17F0, 0x17F9}, {0x1800, 0x1805},
|
||||
{0x1806, 0x1806}, {0x1807, 0x180A}, {0x180B, 0x180D},
|
||||
{0x180E, 0x180E}, {0x1810, 0x1819}, {0x1820, 0x1842},
|
||||
{0x1843, 0x1843}, {0x1844, 0x1877}, {0x1880, 0x1884},
|
||||
{0x1885, 0x1886}, {0x1887, 0x18A8}, {0x18A9, 0x18A9},
|
||||
{0x18AA, 0x18AA}, {0x18B0, 0x18F5}, {0x1900, 0x191E},
|
||||
{0x1920, 0x1922}, {0x1923, 0x1926}, {0x1927, 0x1928},
|
||||
{0x1929, 0x192B}, {0x1930, 0x1931}, {0x1932, 0x1932},
|
||||
{0x1933, 0x1938}, {0x1939, 0x193B}, {0x1940, 0x1940},
|
||||
{0x1944, 0x1945}, {0x1946, 0x194F}, {0x1950, 0x196D},
|
||||
{0x1970, 0x1974}, {0x1980, 0x19AB}, {0x19B0, 0x19C9},
|
||||
{0x19D0, 0x19D9}, {0x19DA, 0x19DA}, {0x19DE, 0x19DF},
|
||||
{0x19E0, 0x19FF}, {0x1A00, 0x1A16}, {0x1A17, 0x1A18},
|
||||
{0x1A19, 0x1A1A}, {0x1A1B, 0x1A1B}, {0x1A1E, 0x1A1F},
|
||||
{0x1A20, 0x1A54}, {0x1A55, 0x1A55}, {0x1A56, 0x1A56},
|
||||
{0x1A57, 0x1A57}, {0x1A58, 0x1A5E}, {0x1A60, 0x1A60},
|
||||
{0x1A61, 0x1A61}, {0x1A62, 0x1A62}, {0x1A63, 0x1A64},
|
||||
{0x1A65, 0x1A6C}, {0x1A6D, 0x1A72}, {0x1A73, 0x1A7C},
|
||||
{0x1A7F, 0x1A7F}, {0x1A80, 0x1A89}, {0x1A90, 0x1A99},
|
||||
{0x1AA0, 0x1AA6}, {0x1AA7, 0x1AA7}, {0x1AA8, 0x1AAD},
|
||||
{0x1AB0, 0x1ABD}, {0x1ABE, 0x1ABE}, {0x1B00, 0x1B03},
|
||||
{0x1B04, 0x1B04}, {0x1B05, 0x1B33}, {0x1B34, 0x1B34},
|
||||
{0x1B35, 0x1B35}, {0x1B36, 0x1B3A}, {0x1B3B, 0x1B3B},
|
||||
{0x1B3C, 0x1B3C}, {0x1B3D, 0x1B41}, {0x1B42, 0x1B42},
|
||||
{0x1B43, 0x1B44}, {0x1B45, 0x1B4B}, {0x1B50, 0x1B59},
|
||||
{0x1B5A, 0x1B60}, {0x1B61, 0x1B6A}, {0x1B6B, 0x1B73},
|
||||
{0x1B74, 0x1B7C}, {0x1B80, 0x1B81}, {0x1B82, 0x1B82},
|
||||
{0x1B83, 0x1BA0}, {0x1BA1, 0x1BA1}, {0x1BA2, 0x1BA5},
|
||||
{0x1BA6, 0x1BA7}, {0x1BA8, 0x1BA9}, {0x1BAA, 0x1BAA},
|
||||
{0x1BAB, 0x1BAD}, {0x1BAE, 0x1BAF}, {0x1BB0, 0x1BB9},
|
||||
{0x1BBA, 0x1BBF}, {0x1BC0, 0x1BE5}, {0x1BE6, 0x1BE6},
|
||||
{0x1BE7, 0x1BE7}, {0x1BE8, 0x1BE9}, {0x1BEA, 0x1BEC},
|
||||
{0x1BED, 0x1BED}, {0x1BEE, 0x1BEE}, {0x1BEF, 0x1BF1},
|
||||
{0x1BF2, 0x1BF3}, {0x1BFC, 0x1BFF}, {0x1C00, 0x1C23},
|
||||
{0x1C24, 0x1C2B}, {0x1C2C, 0x1C33}, {0x1C34, 0x1C35},
|
||||
{0x1C36, 0x1C37}, {0x1C3B, 0x1C3F}, {0x1C40, 0x1C49},
|
||||
{0x1C4D, 0x1C4F}, {0x1C50, 0x1C59}, {0x1C5A, 0x1C77},
|
||||
{0x1C78, 0x1C7D}, {0x1C7E, 0x1C7F}, {0x1C80, 0x1C88},
|
||||
{0x1CC0, 0x1CC7}, {0x1CD0, 0x1CD2}, {0x1CD3, 0x1CD3},
|
||||
{0x1CD4, 0x1CE0}, {0x1CE1, 0x1CE1}, {0x1CE2, 0x1CE8},
|
||||
{0x1CE9, 0x1CEC}, {0x1CED, 0x1CED}, {0x1CEE, 0x1CF1},
|
||||
{0x1CF2, 0x1CF3}, {0x1CF4, 0x1CF4}, {0x1CF5, 0x1CF6},
|
||||
{0x1CF8, 0x1CF9}, {0x1D00, 0x1D2B}, {0x1D2C, 0x1D6A},
|
||||
{0x1D6B, 0x1D77}, {0x1D78, 0x1D78}, {0x1D79, 0x1D7F},
|
||||
{0x1D80, 0x1D9A}, {0x1D9B, 0x1DBF}, {0x1DC0, 0x1DF5},
|
||||
{0x1DFB, 0x1DFF}, {0x1E00, 0x1EFF}, {0x1F00, 0x1F15},
|
||||
{0x0CBC, 0x0CC4}, {0x0CC6, 0x0CC8}, {0x0CCA, 0x0CCD},
|
||||
{0x0CD5, 0x0CD6}, {0x0CDE, 0x0CDE}, {0x0CE0, 0x0CE3},
|
||||
{0x0CE6, 0x0CEF}, {0x0CF1, 0x0CF2}, {0x0D01, 0x0D03},
|
||||
{0x0D05, 0x0D0C}, {0x0D0E, 0x0D10}, {0x0D12, 0x0D3A},
|
||||
{0x0D3D, 0x0D44}, {0x0D46, 0x0D48}, {0x0D4A, 0x0D4F},
|
||||
{0x0D54, 0x0D63}, {0x0D66, 0x0D7F}, {0x0D82, 0x0D83},
|
||||
{0x0D85, 0x0D96}, {0x0D9A, 0x0DB1}, {0x0DB3, 0x0DBB},
|
||||
{0x0DBD, 0x0DBD}, {0x0DC0, 0x0DC6}, {0x0DCA, 0x0DCA},
|
||||
{0x0DCF, 0x0DD4}, {0x0DD6, 0x0DD6}, {0x0DD8, 0x0DDF},
|
||||
{0x0DE6, 0x0DEF}, {0x0DF2, 0x0DF4}, {0x0E01, 0x0E3A},
|
||||
{0x0E3F, 0x0E5B}, {0x0E81, 0x0E82}, {0x0E84, 0x0E84},
|
||||
{0x0E87, 0x0E88}, {0x0E8A, 0x0E8A}, {0x0E8D, 0x0E8D},
|
||||
{0x0E94, 0x0E97}, {0x0E99, 0x0E9F}, {0x0EA1, 0x0EA3},
|
||||
{0x0EA5, 0x0EA5}, {0x0EA7, 0x0EA7}, {0x0EAA, 0x0EAB},
|
||||
{0x0EAD, 0x0EB9}, {0x0EBB, 0x0EBD}, {0x0EC0, 0x0EC4},
|
||||
{0x0EC6, 0x0EC6}, {0x0EC8, 0x0ECD}, {0x0ED0, 0x0ED9},
|
||||
{0x0EDC, 0x0EDF}, {0x0F00, 0x0F47}, {0x0F49, 0x0F6C},
|
||||
{0x0F71, 0x0F97}, {0x0F99, 0x0FBC}, {0x0FBE, 0x0FCC},
|
||||
{0x0FCE, 0x0FDA}, {0x1000, 0x10C5}, {0x10C7, 0x10C7},
|
||||
{0x10CD, 0x10CD}, {0x10D0, 0x10FF}, {0x1160, 0x1248},
|
||||
{0x124A, 0x124D}, {0x1250, 0x1256}, {0x1258, 0x1258},
|
||||
{0x125A, 0x125D}, {0x1260, 0x1288}, {0x128A, 0x128D},
|
||||
{0x1290, 0x12B0}, {0x12B2, 0x12B5}, {0x12B8, 0x12BE},
|
||||
{0x12C0, 0x12C0}, {0x12C2, 0x12C5}, {0x12C8, 0x12D6},
|
||||
{0x12D8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135A},
|
||||
{0x135D, 0x137C}, {0x1380, 0x1399}, {0x13A0, 0x13F5},
|
||||
{0x13F8, 0x13FD}, {0x1400, 0x169C}, {0x16A0, 0x16F8},
|
||||
{0x1700, 0x170C}, {0x170E, 0x1714}, {0x1720, 0x1736},
|
||||
{0x1740, 0x1753}, {0x1760, 0x176C}, {0x176E, 0x1770},
|
||||
{0x1772, 0x1773}, {0x1780, 0x17DD}, {0x17E0, 0x17E9},
|
||||
{0x17F0, 0x17F9}, {0x1800, 0x180E}, {0x1810, 0x1819},
|
||||
{0x1820, 0x1877}, {0x1880, 0x18AA}, {0x18B0, 0x18F5},
|
||||
{0x1900, 0x191E}, {0x1920, 0x192B}, {0x1930, 0x193B},
|
||||
{0x1940, 0x1940}, {0x1944, 0x196D}, {0x1970, 0x1974},
|
||||
{0x1980, 0x19AB}, {0x19B0, 0x19C9}, {0x19D0, 0x19DA},
|
||||
{0x19DE, 0x1A1B}, {0x1A1E, 0x1A5E}, {0x1A60, 0x1A7C},
|
||||
{0x1A7F, 0x1A89}, {0x1A90, 0x1A99}, {0x1AA0, 0x1AAD},
|
||||
{0x1AB0, 0x1ABE}, {0x1B00, 0x1B4B}, {0x1B50, 0x1B7C},
|
||||
{0x1B80, 0x1BF3}, {0x1BFC, 0x1C37}, {0x1C3B, 0x1C49},
|
||||
{0x1C4D, 0x1C88}, {0x1CC0, 0x1CC7}, {0x1CD0, 0x1CF6},
|
||||
{0x1CF8, 0x1CF9}, {0x1D00, 0x1DF5}, {0x1DFB, 0x1F15},
|
||||
{0x1F18, 0x1F1D}, {0x1F20, 0x1F45}, {0x1F48, 0x1F4D},
|
||||
{0x1F50, 0x1F57}, {0x1F59, 0x1F59}, {0x1F5B, 0x1F5B},
|
||||
{0x1F5D, 0x1F5D}, {0x1F5F, 0x1F7D}, {0x1F80, 0x1FB4},
|
||||
{0x1FB6, 0x1FBC}, {0x1FBD, 0x1FBD}, {0x1FBE, 0x1FBE},
|
||||
{0x1FBF, 0x1FC1}, {0x1FC2, 0x1FC4}, {0x1FC6, 0x1FCC},
|
||||
{0x1FCD, 0x1FCF}, {0x1FD0, 0x1FD3}, {0x1FD6, 0x1FDB},
|
||||
{0x1FDD, 0x1FDF}, {0x1FE0, 0x1FEC}, {0x1FED, 0x1FEF},
|
||||
{0x1FF2, 0x1FF4}, {0x1FF6, 0x1FFC}, {0x1FFD, 0x1FFE},
|
||||
{0x2000, 0x200A}, {0x200B, 0x200F}, {0x2011, 0x2012},
|
||||
{0x2017, 0x2017}, {0x201A, 0x201A}, {0x201B, 0x201B},
|
||||
{0x201E, 0x201E}, {0x201F, 0x201F}, {0x2023, 0x2023},
|
||||
{0x2028, 0x2028}, {0x2029, 0x2029}, {0x202A, 0x202E},
|
||||
{0x202F, 0x202F}, {0x2031, 0x2031}, {0x2034, 0x2034},
|
||||
{0x2036, 0x2038}, {0x2039, 0x2039}, {0x203A, 0x203A},
|
||||
{0x203C, 0x203D}, {0x203F, 0x2040}, {0x2041, 0x2043},
|
||||
{0x2044, 0x2044}, {0x2045, 0x2045}, {0x2046, 0x2046},
|
||||
{0x2047, 0x2051}, {0x2052, 0x2052}, {0x2053, 0x2053},
|
||||
{0x2054, 0x2054}, {0x2055, 0x205E}, {0x205F, 0x205F},
|
||||
{0x2060, 0x2064}, {0x2066, 0x206F}, {0x2070, 0x2070},
|
||||
{0x2071, 0x2071}, {0x2075, 0x2079}, {0x207A, 0x207C},
|
||||
{0x207D, 0x207D}, {0x207E, 0x207E}, {0x2080, 0x2080},
|
||||
{0x2085, 0x2089}, {0x208A, 0x208C}, {0x208D, 0x208D},
|
||||
{0x208E, 0x208E}, {0x2090, 0x209C}, {0x20A0, 0x20A8},
|
||||
{0x20AA, 0x20AB}, {0x20AD, 0x20BE}, {0x20D0, 0x20DC},
|
||||
{0x20DD, 0x20E0}, {0x20E1, 0x20E1}, {0x20E2, 0x20E4},
|
||||
{0x20E5, 0x20F0}, {0x2100, 0x2101}, {0x2102, 0x2102},
|
||||
{0x2104, 0x2104}, {0x2106, 0x2106}, {0x2107, 0x2107},
|
||||
{0x2108, 0x2108}, {0x210A, 0x2112}, {0x2114, 0x2114},
|
||||
{0x2115, 0x2115}, {0x2117, 0x2117}, {0x2118, 0x2118},
|
||||
{0x2119, 0x211D}, {0x211E, 0x2120}, {0x2123, 0x2123},
|
||||
{0x2124, 0x2124}, {0x2125, 0x2125}, {0x2127, 0x2127},
|
||||
{0x2128, 0x2128}, {0x2129, 0x2129}, {0x212A, 0x212A},
|
||||
{0x212C, 0x212D}, {0x212E, 0x212E}, {0x212F, 0x2134},
|
||||
{0x2135, 0x2138}, {0x2139, 0x2139}, {0x213A, 0x213B},
|
||||
{0x213C, 0x213F}, {0x2140, 0x2144}, {0x2145, 0x2149},
|
||||
{0x214A, 0x214A}, {0x214B, 0x214B}, {0x214C, 0x214D},
|
||||
{0x214E, 0x214E}, {0x214F, 0x214F}, {0x2150, 0x2152},
|
||||
{0x1FB6, 0x1FC4}, {0x1FC6, 0x1FD3}, {0x1FD6, 0x1FDB},
|
||||
{0x1FDD, 0x1FEF}, {0x1FF2, 0x1FF4}, {0x1FF6, 0x1FFE},
|
||||
{0x2000, 0x200F}, {0x2011, 0x2012}, {0x2017, 0x2017},
|
||||
{0x201A, 0x201B}, {0x201E, 0x201F}, {0x2023, 0x2023},
|
||||
{0x2028, 0x202F}, {0x2031, 0x2031}, {0x2034, 0x2034},
|
||||
{0x2036, 0x203A}, {0x203C, 0x203D}, {0x203F, 0x2064},
|
||||
{0x2066, 0x2071}, {0x2075, 0x207E}, {0x2080, 0x2080},
|
||||
{0x2085, 0x208E}, {0x2090, 0x209C}, {0x20A0, 0x20A8},
|
||||
{0x20AA, 0x20AB}, {0x20AD, 0x20BE}, {0x20D0, 0x20F0},
|
||||
{0x2100, 0x2102}, {0x2104, 0x2104}, {0x2106, 0x2108},
|
||||
{0x210A, 0x2112}, {0x2114, 0x2115}, {0x2117, 0x2120},
|
||||
{0x2123, 0x2125}, {0x2127, 0x212A}, {0x212C, 0x2152},
|
||||
{0x2155, 0x215A}, {0x215F, 0x215F}, {0x216C, 0x216F},
|
||||
{0x217A, 0x2182}, {0x2183, 0x2184}, {0x2185, 0x2188},
|
||||
{0x218A, 0x218B}, {0x219A, 0x219B}, {0x219C, 0x219F},
|
||||
{0x21A0, 0x21A0}, {0x21A1, 0x21A2}, {0x21A3, 0x21A3},
|
||||
{0x21A4, 0x21A5}, {0x21A6, 0x21A6}, {0x21A7, 0x21AD},
|
||||
{0x21AE, 0x21AE}, {0x21AF, 0x21B7}, {0x21BA, 0x21CD},
|
||||
{0x21CE, 0x21CF}, {0x21D0, 0x21D1}, {0x21D3, 0x21D3},
|
||||
{0x21D5, 0x21E6}, {0x21E8, 0x21F3}, {0x21F4, 0x21FF},
|
||||
{0x2201, 0x2201}, {0x2204, 0x2206}, {0x2209, 0x220A},
|
||||
{0x220C, 0x220E}, {0x2210, 0x2210}, {0x2212, 0x2214},
|
||||
{0x2216, 0x2219}, {0x221B, 0x221C}, {0x2221, 0x2222},
|
||||
{0x2224, 0x2224}, {0x2226, 0x2226}, {0x222D, 0x222D},
|
||||
{0x222F, 0x2233}, {0x2238, 0x223B}, {0x223E, 0x2247},
|
||||
{0x2249, 0x224B}, {0x224D, 0x2251}, {0x2253, 0x225F},
|
||||
{0x2262, 0x2263}, {0x2268, 0x2269}, {0x226C, 0x226D},
|
||||
{0x2270, 0x2281}, {0x2284, 0x2285}, {0x2288, 0x2294},
|
||||
{0x2296, 0x2298}, {0x229A, 0x22A4}, {0x22A6, 0x22BE},
|
||||
{0x22C0, 0x22FF}, {0x2300, 0x2307}, {0x2308, 0x2308},
|
||||
{0x2309, 0x2309}, {0x230A, 0x230A}, {0x230B, 0x230B},
|
||||
{0x230C, 0x2311}, {0x2313, 0x2319}, {0x231C, 0x231F},
|
||||
{0x2320, 0x2321}, {0x2322, 0x2328}, {0x232B, 0x237B},
|
||||
{0x237C, 0x237C}, {0x237D, 0x239A}, {0x239B, 0x23B3},
|
||||
{0x23B4, 0x23DB}, {0x23DC, 0x23E1}, {0x23E2, 0x23E8},
|
||||
{0x23ED, 0x23EF}, {0x23F1, 0x23F2}, {0x23F4, 0x23FE},
|
||||
{0x2400, 0x2426}, {0x2440, 0x244A}, {0x24EA, 0x24EA},
|
||||
{0x254C, 0x254F}, {0x2574, 0x257F}, {0x2590, 0x2591},
|
||||
{0x2596, 0x259F}, {0x25A2, 0x25A2}, {0x25AA, 0x25B1},
|
||||
{0x25B4, 0x25B5}, {0x25B8, 0x25BB}, {0x25BE, 0x25BF},
|
||||
{0x25C2, 0x25C5}, {0x25C9, 0x25CA}, {0x25CC, 0x25CD},
|
||||
{0x25D2, 0x25E1}, {0x25E6, 0x25EE}, {0x25F0, 0x25F7},
|
||||
{0x25F8, 0x25FC}, {0x25FF, 0x25FF}, {0x2600, 0x2604},
|
||||
{0x217A, 0x2188}, {0x218A, 0x218B}, {0x219A, 0x21B7},
|
||||
{0x21BA, 0x21D1}, {0x21D3, 0x21D3}, {0x21D5, 0x21E6},
|
||||
{0x21E8, 0x21FF}, {0x2201, 0x2201}, {0x2204, 0x2206},
|
||||
{0x2209, 0x220A}, {0x220C, 0x220E}, {0x2210, 0x2210},
|
||||
{0x2212, 0x2214}, {0x2216, 0x2219}, {0x221B, 0x221C},
|
||||
{0x2221, 0x2222}, {0x2224, 0x2224}, {0x2226, 0x2226},
|
||||
{0x222D, 0x222D}, {0x222F, 0x2233}, {0x2238, 0x223B},
|
||||
{0x223E, 0x2247}, {0x2249, 0x224B}, {0x224D, 0x2251},
|
||||
{0x2253, 0x225F}, {0x2262, 0x2263}, {0x2268, 0x2269},
|
||||
{0x226C, 0x226D}, {0x2270, 0x2281}, {0x2284, 0x2285},
|
||||
{0x2288, 0x2294}, {0x2296, 0x2298}, {0x229A, 0x22A4},
|
||||
{0x22A6, 0x22BE}, {0x22C0, 0x2311}, {0x2313, 0x2319},
|
||||
{0x231C, 0x2328}, {0x232B, 0x23E8}, {0x23ED, 0x23EF},
|
||||
{0x23F1, 0x23F2}, {0x23F4, 0x23FE}, {0x2400, 0x2426},
|
||||
{0x2440, 0x244A}, {0x24EA, 0x24EA}, {0x254C, 0x254F},
|
||||
{0x2574, 0x257F}, {0x2590, 0x2591}, {0x2596, 0x259F},
|
||||
{0x25A2, 0x25A2}, {0x25AA, 0x25B1}, {0x25B4, 0x25B5},
|
||||
{0x25B8, 0x25BB}, {0x25BE, 0x25BF}, {0x25C2, 0x25C5},
|
||||
{0x25C9, 0x25CA}, {0x25CC, 0x25CD}, {0x25D2, 0x25E1},
|
||||
{0x25E6, 0x25EE}, {0x25F0, 0x25FC}, {0x25FF, 0x2604},
|
||||
{0x2607, 0x2608}, {0x260A, 0x260D}, {0x2610, 0x2613},
|
||||
{0x2616, 0x261B}, {0x261D, 0x261D}, {0x261F, 0x263F},
|
||||
{0x2641, 0x2641}, {0x2643, 0x2647}, {0x2654, 0x265F},
|
||||
|
|
@ -811,256 +684,98 @@ var neutral = table{
|
|||
{0x26E4, 0x26E7}, {0x2700, 0x2704}, {0x2706, 0x2709},
|
||||
{0x270C, 0x2727}, {0x2729, 0x273C}, {0x273E, 0x274B},
|
||||
{0x274D, 0x274D}, {0x274F, 0x2752}, {0x2756, 0x2756},
|
||||
{0x2758, 0x2767}, {0x2768, 0x2768}, {0x2769, 0x2769},
|
||||
{0x276A, 0x276A}, {0x276B, 0x276B}, {0x276C, 0x276C},
|
||||
{0x276D, 0x276D}, {0x276E, 0x276E}, {0x276F, 0x276F},
|
||||
{0x2770, 0x2770}, {0x2771, 0x2771}, {0x2772, 0x2772},
|
||||
{0x2773, 0x2773}, {0x2774, 0x2774}, {0x2775, 0x2775},
|
||||
{0x2780, 0x2793}, {0x2794, 0x2794}, {0x2798, 0x27AF},
|
||||
{0x27B1, 0x27BE}, {0x27C0, 0x27C4}, {0x27C5, 0x27C5},
|
||||
{0x27C6, 0x27C6}, {0x27C7, 0x27E5}, {0x27EE, 0x27EE},
|
||||
{0x27EF, 0x27EF}, {0x27F0, 0x27FF}, {0x2800, 0x28FF},
|
||||
{0x2900, 0x297F}, {0x2980, 0x2982}, {0x2983, 0x2983},
|
||||
{0x2984, 0x2984}, {0x2987, 0x2987}, {0x2988, 0x2988},
|
||||
{0x2989, 0x2989}, {0x298A, 0x298A}, {0x298B, 0x298B},
|
||||
{0x298C, 0x298C}, {0x298D, 0x298D}, {0x298E, 0x298E},
|
||||
{0x298F, 0x298F}, {0x2990, 0x2990}, {0x2991, 0x2991},
|
||||
{0x2992, 0x2992}, {0x2993, 0x2993}, {0x2994, 0x2994},
|
||||
{0x2995, 0x2995}, {0x2996, 0x2996}, {0x2997, 0x2997},
|
||||
{0x2998, 0x2998}, {0x2999, 0x29D7}, {0x29D8, 0x29D8},
|
||||
{0x29D9, 0x29D9}, {0x29DA, 0x29DA}, {0x29DB, 0x29DB},
|
||||
{0x29DC, 0x29FB}, {0x29FC, 0x29FC}, {0x29FD, 0x29FD},
|
||||
{0x29FE, 0x29FF}, {0x2A00, 0x2AFF}, {0x2B00, 0x2B1A},
|
||||
{0x2B1D, 0x2B2F}, {0x2B30, 0x2B44}, {0x2B45, 0x2B46},
|
||||
{0x2B47, 0x2B4C}, {0x2B4D, 0x2B4F}, {0x2B51, 0x2B54},
|
||||
{0x2758, 0x2775}, {0x2780, 0x2794}, {0x2798, 0x27AF},
|
||||
{0x27B1, 0x27BE}, {0x27C0, 0x27E5}, {0x27EE, 0x2984},
|
||||
{0x2987, 0x2B1A}, {0x2B1D, 0x2B4F}, {0x2B51, 0x2B54},
|
||||
{0x2B5A, 0x2B73}, {0x2B76, 0x2B95}, {0x2B98, 0x2BB9},
|
||||
{0x2BBD, 0x2BC8}, {0x2BCA, 0x2BD1}, {0x2BEC, 0x2BEF},
|
||||
{0x2C00, 0x2C2E}, {0x2C30, 0x2C5E}, {0x2C60, 0x2C7B},
|
||||
{0x2C7C, 0x2C7D}, {0x2C7E, 0x2C7F}, {0x2C80, 0x2CE4},
|
||||
{0x2CE5, 0x2CEA}, {0x2CEB, 0x2CEE}, {0x2CEF, 0x2CF1},
|
||||
{0x2CF2, 0x2CF3}, {0x2CF9, 0x2CFC}, {0x2CFD, 0x2CFD},
|
||||
{0x2CFE, 0x2CFF}, {0x2D00, 0x2D25}, {0x2D27, 0x2D27},
|
||||
{0x2D2D, 0x2D2D}, {0x2D30, 0x2D67}, {0x2D6F, 0x2D6F},
|
||||
{0x2D70, 0x2D70}, {0x2D7F, 0x2D7F}, {0x2D80, 0x2D96},
|
||||
{0x2C00, 0x2C2E}, {0x2C30, 0x2C5E}, {0x2C60, 0x2CF3},
|
||||
{0x2CF9, 0x2D25}, {0x2D27, 0x2D27}, {0x2D2D, 0x2D2D},
|
||||
{0x2D30, 0x2D67}, {0x2D6F, 0x2D70}, {0x2D7F, 0x2D96},
|
||||
{0x2DA0, 0x2DA6}, {0x2DA8, 0x2DAE}, {0x2DB0, 0x2DB6},
|
||||
{0x2DB8, 0x2DBE}, {0x2DC0, 0x2DC6}, {0x2DC8, 0x2DCE},
|
||||
{0x2DD0, 0x2DD6}, {0x2DD8, 0x2DDE}, {0x2DE0, 0x2DFF},
|
||||
{0x2E00, 0x2E01}, {0x2E02, 0x2E02}, {0x2E03, 0x2E03},
|
||||
{0x2E04, 0x2E04}, {0x2E05, 0x2E05}, {0x2E06, 0x2E08},
|
||||
{0x2E09, 0x2E09}, {0x2E0A, 0x2E0A}, {0x2E0B, 0x2E0B},
|
||||
{0x2E0C, 0x2E0C}, {0x2E0D, 0x2E0D}, {0x2E0E, 0x2E16},
|
||||
{0x2E17, 0x2E17}, {0x2E18, 0x2E19}, {0x2E1A, 0x2E1A},
|
||||
{0x2E1B, 0x2E1B}, {0x2E1C, 0x2E1C}, {0x2E1D, 0x2E1D},
|
||||
{0x2E1E, 0x2E1F}, {0x2E20, 0x2E20}, {0x2E21, 0x2E21},
|
||||
{0x2E22, 0x2E22}, {0x2E23, 0x2E23}, {0x2E24, 0x2E24},
|
||||
{0x2E25, 0x2E25}, {0x2E26, 0x2E26}, {0x2E27, 0x2E27},
|
||||
{0x2E28, 0x2E28}, {0x2E29, 0x2E29}, {0x2E2A, 0x2E2E},
|
||||
{0x2E2F, 0x2E2F}, {0x2E30, 0x2E39}, {0x2E3A, 0x2E3B},
|
||||
{0x2E3C, 0x2E3F}, {0x2E40, 0x2E40}, {0x2E41, 0x2E41},
|
||||
{0x2E42, 0x2E42}, {0x2E43, 0x2E44}, {0x303F, 0x303F},
|
||||
{0x4DC0, 0x4DFF}, {0xA4D0, 0xA4F7}, {0xA4F8, 0xA4FD},
|
||||
{0xA4FE, 0xA4FF}, {0xA500, 0xA60B}, {0xA60C, 0xA60C},
|
||||
{0xA60D, 0xA60F}, {0xA610, 0xA61F}, {0xA620, 0xA629},
|
||||
{0xA62A, 0xA62B}, {0xA640, 0xA66D}, {0xA66E, 0xA66E},
|
||||
{0xA66F, 0xA66F}, {0xA670, 0xA672}, {0xA673, 0xA673},
|
||||
{0xA674, 0xA67D}, {0xA67E, 0xA67E}, {0xA67F, 0xA67F},
|
||||
{0xA680, 0xA69B}, {0xA69C, 0xA69D}, {0xA69E, 0xA69F},
|
||||
{0xA6A0, 0xA6E5}, {0xA6E6, 0xA6EF}, {0xA6F0, 0xA6F1},
|
||||
{0xA6F2, 0xA6F7}, {0xA700, 0xA716}, {0xA717, 0xA71F},
|
||||
{0xA720, 0xA721}, {0xA722, 0xA76F}, {0xA770, 0xA770},
|
||||
{0xA771, 0xA787}, {0xA788, 0xA788}, {0xA789, 0xA78A},
|
||||
{0xA78B, 0xA78E}, {0xA78F, 0xA78F}, {0xA790, 0xA7AE},
|
||||
{0xA7B0, 0xA7B7}, {0xA7F7, 0xA7F7}, {0xA7F8, 0xA7F9},
|
||||
{0xA7FA, 0xA7FA}, {0xA7FB, 0xA7FF}, {0xA800, 0xA801},
|
||||
{0xA802, 0xA802}, {0xA803, 0xA805}, {0xA806, 0xA806},
|
||||
{0xA807, 0xA80A}, {0xA80B, 0xA80B}, {0xA80C, 0xA822},
|
||||
{0xA823, 0xA824}, {0xA825, 0xA826}, {0xA827, 0xA827},
|
||||
{0xA828, 0xA82B}, {0xA830, 0xA835}, {0xA836, 0xA837},
|
||||
{0xA838, 0xA838}, {0xA839, 0xA839}, {0xA840, 0xA873},
|
||||
{0xA874, 0xA877}, {0xA880, 0xA881}, {0xA882, 0xA8B3},
|
||||
{0xA8B4, 0xA8C3}, {0xA8C4, 0xA8C5}, {0xA8CE, 0xA8CF},
|
||||
{0xA8D0, 0xA8D9}, {0xA8E0, 0xA8F1}, {0xA8F2, 0xA8F7},
|
||||
{0xA8F8, 0xA8FA}, {0xA8FB, 0xA8FB}, {0xA8FC, 0xA8FC},
|
||||
{0xA8FD, 0xA8FD}, {0xA900, 0xA909}, {0xA90A, 0xA925},
|
||||
{0xA926, 0xA92D}, {0xA92E, 0xA92F}, {0xA930, 0xA946},
|
||||
{0xA947, 0xA951}, {0xA952, 0xA953}, {0xA95F, 0xA95F},
|
||||
{0xA980, 0xA982}, {0xA983, 0xA983}, {0xA984, 0xA9B2},
|
||||
{0xA9B3, 0xA9B3}, {0xA9B4, 0xA9B5}, {0xA9B6, 0xA9B9},
|
||||
{0xA9BA, 0xA9BB}, {0xA9BC, 0xA9BC}, {0xA9BD, 0xA9C0},
|
||||
{0xA9C1, 0xA9CD}, {0xA9CF, 0xA9CF}, {0xA9D0, 0xA9D9},
|
||||
{0xA9DE, 0xA9DF}, {0xA9E0, 0xA9E4}, {0xA9E5, 0xA9E5},
|
||||
{0xA9E6, 0xA9E6}, {0xA9E7, 0xA9EF}, {0xA9F0, 0xA9F9},
|
||||
{0xA9FA, 0xA9FE}, {0xAA00, 0xAA28}, {0xAA29, 0xAA2E},
|
||||
{0xAA2F, 0xAA30}, {0xAA31, 0xAA32}, {0xAA33, 0xAA34},
|
||||
{0xAA35, 0xAA36}, {0xAA40, 0xAA42}, {0xAA43, 0xAA43},
|
||||
{0xAA44, 0xAA4B}, {0xAA4C, 0xAA4C}, {0xAA4D, 0xAA4D},
|
||||
{0xAA50, 0xAA59}, {0xAA5C, 0xAA5F}, {0xAA60, 0xAA6F},
|
||||
{0xAA70, 0xAA70}, {0xAA71, 0xAA76}, {0xAA77, 0xAA79},
|
||||
{0xAA7A, 0xAA7A}, {0xAA7B, 0xAA7B}, {0xAA7C, 0xAA7C},
|
||||
{0xAA7D, 0xAA7D}, {0xAA7E, 0xAA7F}, {0xAA80, 0xAAAF},
|
||||
{0xAAB0, 0xAAB0}, {0xAAB1, 0xAAB1}, {0xAAB2, 0xAAB4},
|
||||
{0xAAB5, 0xAAB6}, {0xAAB7, 0xAAB8}, {0xAAB9, 0xAABD},
|
||||
{0xAABE, 0xAABF}, {0xAAC0, 0xAAC0}, {0xAAC1, 0xAAC1},
|
||||
{0xAAC2, 0xAAC2}, {0xAADB, 0xAADC}, {0xAADD, 0xAADD},
|
||||
{0xAADE, 0xAADF}, {0xAAE0, 0xAAEA}, {0xAAEB, 0xAAEB},
|
||||
{0xAAEC, 0xAAED}, {0xAAEE, 0xAAEF}, {0xAAF0, 0xAAF1},
|
||||
{0xAAF2, 0xAAF2}, {0xAAF3, 0xAAF4}, {0xAAF5, 0xAAF5},
|
||||
{0xAAF6, 0xAAF6}, {0xAB01, 0xAB06}, {0xAB09, 0xAB0E},
|
||||
{0x2DD0, 0x2DD6}, {0x2DD8, 0x2DDE}, {0x2DE0, 0x2E44},
|
||||
{0x303F, 0x303F}, {0x4DC0, 0x4DFF}, {0xA4D0, 0xA62B},
|
||||
{0xA640, 0xA6F7}, {0xA700, 0xA7AE}, {0xA7B0, 0xA7B7},
|
||||
{0xA7F7, 0xA82B}, {0xA830, 0xA839}, {0xA840, 0xA877},
|
||||
{0xA880, 0xA8C5}, {0xA8CE, 0xA8D9}, {0xA8E0, 0xA8FD},
|
||||
{0xA900, 0xA953}, {0xA95F, 0xA95F}, {0xA980, 0xA9CD},
|
||||
{0xA9CF, 0xA9D9}, {0xA9DE, 0xA9FE}, {0xAA00, 0xAA36},
|
||||
{0xAA40, 0xAA4D}, {0xAA50, 0xAA59}, {0xAA5C, 0xAAC2},
|
||||
{0xAADB, 0xAAF6}, {0xAB01, 0xAB06}, {0xAB09, 0xAB0E},
|
||||
{0xAB11, 0xAB16}, {0xAB20, 0xAB26}, {0xAB28, 0xAB2E},
|
||||
{0xAB30, 0xAB5A}, {0xAB5B, 0xAB5B}, {0xAB5C, 0xAB5F},
|
||||
{0xAB60, 0xAB65}, {0xAB70, 0xABBF}, {0xABC0, 0xABE2},
|
||||
{0xABE3, 0xABE4}, {0xABE5, 0xABE5}, {0xABE6, 0xABE7},
|
||||
{0xABE8, 0xABE8}, {0xABE9, 0xABEA}, {0xABEB, 0xABEB},
|
||||
{0xABEC, 0xABEC}, {0xABED, 0xABED}, {0xABF0, 0xABF9},
|
||||
{0xD7B0, 0xD7C6}, {0xD7CB, 0xD7FB}, {0xD800, 0xDB7F},
|
||||
{0xDB80, 0xDBFF}, {0xDC00, 0xDFFF}, {0xFB00, 0xFB06},
|
||||
{0xFB13, 0xFB17}, {0xFB1D, 0xFB1D}, {0xFB1E, 0xFB1E},
|
||||
{0xFB1F, 0xFB28}, {0xFB29, 0xFB29}, {0xFB2A, 0xFB36},
|
||||
{0xAB30, 0xAB65}, {0xAB70, 0xABED}, {0xABF0, 0xABF9},
|
||||
{0xD7B0, 0xD7C6}, {0xD7CB, 0xD7FB}, {0xD800, 0xDFFF},
|
||||
{0xFB00, 0xFB06}, {0xFB13, 0xFB17}, {0xFB1D, 0xFB36},
|
||||
{0xFB38, 0xFB3C}, {0xFB3E, 0xFB3E}, {0xFB40, 0xFB41},
|
||||
{0xFB43, 0xFB44}, {0xFB46, 0xFB4F}, {0xFB50, 0xFBB1},
|
||||
{0xFBB2, 0xFBC1}, {0xFBD3, 0xFD3D}, {0xFD3E, 0xFD3E},
|
||||
{0xFD3F, 0xFD3F}, {0xFD50, 0xFD8F}, {0xFD92, 0xFDC7},
|
||||
{0xFDF0, 0xFDFB}, {0xFDFC, 0xFDFC}, {0xFDFD, 0xFDFD},
|
||||
{0xFB43, 0xFB44}, {0xFB46, 0xFBC1}, {0xFBD3, 0xFD3F},
|
||||
{0xFD50, 0xFD8F}, {0xFD92, 0xFDC7}, {0xFDF0, 0xFDFD},
|
||||
{0xFE20, 0xFE2F}, {0xFE70, 0xFE74}, {0xFE76, 0xFEFC},
|
||||
{0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFB}, {0xFFFC, 0xFFFC},
|
||||
{0x10000, 0x1000B}, {0x1000D, 0x10026}, {0x10028, 0x1003A},
|
||||
{0x1003C, 0x1003D}, {0x1003F, 0x1004D}, {0x10050, 0x1005D},
|
||||
{0x10080, 0x100FA}, {0x10100, 0x10102}, {0x10107, 0x10133},
|
||||
{0x10137, 0x1013F}, {0x10140, 0x10174}, {0x10175, 0x10178},
|
||||
{0x10179, 0x10189}, {0x1018A, 0x1018B}, {0x1018C, 0x1018E},
|
||||
{0x10190, 0x1019B}, {0x101A0, 0x101A0}, {0x101D0, 0x101FC},
|
||||
{0x101FD, 0x101FD}, {0x10280, 0x1029C}, {0x102A0, 0x102D0},
|
||||
{0x102E0, 0x102E0}, {0x102E1, 0x102FB}, {0x10300, 0x1031F},
|
||||
{0x10320, 0x10323}, {0x10330, 0x10340}, {0x10341, 0x10341},
|
||||
{0x10342, 0x10349}, {0x1034A, 0x1034A}, {0x10350, 0x10375},
|
||||
{0x10376, 0x1037A}, {0x10380, 0x1039D}, {0x1039F, 0x1039F},
|
||||
{0x103A0, 0x103C3}, {0x103C8, 0x103CF}, {0x103D0, 0x103D0},
|
||||
{0x103D1, 0x103D5}, {0x10400, 0x1044F}, {0x10450, 0x1047F},
|
||||
{0x10480, 0x1049D}, {0x104A0, 0x104A9}, {0x104B0, 0x104D3},
|
||||
{0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFC}, {0x10000, 0x1000B},
|
||||
{0x1000D, 0x10026}, {0x10028, 0x1003A}, {0x1003C, 0x1003D},
|
||||
{0x1003F, 0x1004D}, {0x10050, 0x1005D}, {0x10080, 0x100FA},
|
||||
{0x10100, 0x10102}, {0x10107, 0x10133}, {0x10137, 0x1018E},
|
||||
{0x10190, 0x1019B}, {0x101A0, 0x101A0}, {0x101D0, 0x101FD},
|
||||
{0x10280, 0x1029C}, {0x102A0, 0x102D0}, {0x102E0, 0x102FB},
|
||||
{0x10300, 0x10323}, {0x10330, 0x1034A}, {0x10350, 0x1037A},
|
||||
{0x10380, 0x1039D}, {0x1039F, 0x103C3}, {0x103C8, 0x103D5},
|
||||
{0x10400, 0x1049D}, {0x104A0, 0x104A9}, {0x104B0, 0x104D3},
|
||||
{0x104D8, 0x104FB}, {0x10500, 0x10527}, {0x10530, 0x10563},
|
||||
{0x1056F, 0x1056F}, {0x10600, 0x10736}, {0x10740, 0x10755},
|
||||
{0x10760, 0x10767}, {0x10800, 0x10805}, {0x10808, 0x10808},
|
||||
{0x1080A, 0x10835}, {0x10837, 0x10838}, {0x1083C, 0x1083C},
|
||||
{0x1083F, 0x1083F}, {0x10840, 0x10855}, {0x10857, 0x10857},
|
||||
{0x10858, 0x1085F}, {0x10860, 0x10876}, {0x10877, 0x10878},
|
||||
{0x10879, 0x1087F}, {0x10880, 0x1089E}, {0x108A7, 0x108AF},
|
||||
{0x108E0, 0x108F2}, {0x108F4, 0x108F5}, {0x108FB, 0x108FF},
|
||||
{0x10900, 0x10915}, {0x10916, 0x1091B}, {0x1091F, 0x1091F},
|
||||
{0x10920, 0x10939}, {0x1093F, 0x1093F}, {0x10980, 0x1099F},
|
||||
{0x109A0, 0x109B7}, {0x109BC, 0x109BD}, {0x109BE, 0x109BF},
|
||||
{0x109C0, 0x109CF}, {0x109D2, 0x109FF}, {0x10A00, 0x10A00},
|
||||
{0x10A01, 0x10A03}, {0x10A05, 0x10A06}, {0x10A0C, 0x10A0F},
|
||||
{0x10A10, 0x10A13}, {0x10A15, 0x10A17}, {0x10A19, 0x10A33},
|
||||
{0x10A38, 0x10A3A}, {0x10A3F, 0x10A3F}, {0x10A40, 0x10A47},
|
||||
{0x10A50, 0x10A58}, {0x10A60, 0x10A7C}, {0x10A7D, 0x10A7E},
|
||||
{0x10A7F, 0x10A7F}, {0x10A80, 0x10A9C}, {0x10A9D, 0x10A9F},
|
||||
{0x10AC0, 0x10AC7}, {0x10AC8, 0x10AC8}, {0x10AC9, 0x10AE4},
|
||||
{0x10AE5, 0x10AE6}, {0x10AEB, 0x10AEF}, {0x10AF0, 0x10AF6},
|
||||
{0x10B00, 0x10B35}, {0x10B39, 0x10B3F}, {0x10B40, 0x10B55},
|
||||
{0x10B58, 0x10B5F}, {0x10B60, 0x10B72}, {0x10B78, 0x10B7F},
|
||||
{0x10B80, 0x10B91}, {0x10B99, 0x10B9C}, {0x10BA9, 0x10BAF},
|
||||
{0x1083F, 0x10855}, {0x10857, 0x1089E}, {0x108A7, 0x108AF},
|
||||
{0x108E0, 0x108F2}, {0x108F4, 0x108F5}, {0x108FB, 0x1091B},
|
||||
{0x1091F, 0x10939}, {0x1093F, 0x1093F}, {0x10980, 0x109B7},
|
||||
{0x109BC, 0x109CF}, {0x109D2, 0x10A03}, {0x10A05, 0x10A06},
|
||||
{0x10A0C, 0x10A13}, {0x10A15, 0x10A17}, {0x10A19, 0x10A33},
|
||||
{0x10A38, 0x10A3A}, {0x10A3F, 0x10A47}, {0x10A50, 0x10A58},
|
||||
{0x10A60, 0x10A9F}, {0x10AC0, 0x10AE6}, {0x10AEB, 0x10AF6},
|
||||
{0x10B00, 0x10B35}, {0x10B39, 0x10B55}, {0x10B58, 0x10B72},
|
||||
{0x10B78, 0x10B91}, {0x10B99, 0x10B9C}, {0x10BA9, 0x10BAF},
|
||||
{0x10C00, 0x10C48}, {0x10C80, 0x10CB2}, {0x10CC0, 0x10CF2},
|
||||
{0x10CFA, 0x10CFF}, {0x10E60, 0x10E7E}, {0x11000, 0x11000},
|
||||
{0x11001, 0x11001}, {0x11002, 0x11002}, {0x11003, 0x11037},
|
||||
{0x11038, 0x11046}, {0x11047, 0x1104D}, {0x11052, 0x11065},
|
||||
{0x11066, 0x1106F}, {0x1107F, 0x1107F}, {0x11080, 0x11081},
|
||||
{0x11082, 0x11082}, {0x11083, 0x110AF}, {0x110B0, 0x110B2},
|
||||
{0x110B3, 0x110B6}, {0x110B7, 0x110B8}, {0x110B9, 0x110BA},
|
||||
{0x110BB, 0x110BC}, {0x110BD, 0x110BD}, {0x110BE, 0x110C1},
|
||||
{0x110D0, 0x110E8}, {0x110F0, 0x110F9}, {0x11100, 0x11102},
|
||||
{0x11103, 0x11126}, {0x11127, 0x1112B}, {0x1112C, 0x1112C},
|
||||
{0x1112D, 0x11134}, {0x11136, 0x1113F}, {0x11140, 0x11143},
|
||||
{0x11150, 0x11172}, {0x11173, 0x11173}, {0x11174, 0x11175},
|
||||
{0x11176, 0x11176}, {0x11180, 0x11181}, {0x11182, 0x11182},
|
||||
{0x11183, 0x111B2}, {0x111B3, 0x111B5}, {0x111B6, 0x111BE},
|
||||
{0x111BF, 0x111C0}, {0x111C1, 0x111C4}, {0x111C5, 0x111C9},
|
||||
{0x111CA, 0x111CC}, {0x111CD, 0x111CD}, {0x111D0, 0x111D9},
|
||||
{0x111DA, 0x111DA}, {0x111DB, 0x111DB}, {0x111DC, 0x111DC},
|
||||
{0x111DD, 0x111DF}, {0x111E1, 0x111F4}, {0x11200, 0x11211},
|
||||
{0x11213, 0x1122B}, {0x1122C, 0x1122E}, {0x1122F, 0x11231},
|
||||
{0x11232, 0x11233}, {0x11234, 0x11234}, {0x11235, 0x11235},
|
||||
{0x11236, 0x11237}, {0x11238, 0x1123D}, {0x1123E, 0x1123E},
|
||||
{0x10CFA, 0x10CFF}, {0x10E60, 0x10E7E}, {0x11000, 0x1104D},
|
||||
{0x11052, 0x1106F}, {0x1107F, 0x110C1}, {0x110D0, 0x110E8},
|
||||
{0x110F0, 0x110F9}, {0x11100, 0x11134}, {0x11136, 0x11143},
|
||||
{0x11150, 0x11176}, {0x11180, 0x111CD}, {0x111D0, 0x111DF},
|
||||
{0x111E1, 0x111F4}, {0x11200, 0x11211}, {0x11213, 0x1123E},
|
||||
{0x11280, 0x11286}, {0x11288, 0x11288}, {0x1128A, 0x1128D},
|
||||
{0x1128F, 0x1129D}, {0x1129F, 0x112A8}, {0x112A9, 0x112A9},
|
||||
{0x112B0, 0x112DE}, {0x112DF, 0x112DF}, {0x112E0, 0x112E2},
|
||||
{0x112E3, 0x112EA}, {0x112F0, 0x112F9}, {0x11300, 0x11301},
|
||||
{0x11302, 0x11303}, {0x11305, 0x1130C}, {0x1130F, 0x11310},
|
||||
{0x11313, 0x11328}, {0x1132A, 0x11330}, {0x11332, 0x11333},
|
||||
{0x11335, 0x11339}, {0x1133C, 0x1133C}, {0x1133D, 0x1133D},
|
||||
{0x1133E, 0x1133F}, {0x11340, 0x11340}, {0x11341, 0x11344},
|
||||
{0x1128F, 0x1129D}, {0x1129F, 0x112A9}, {0x112B0, 0x112EA},
|
||||
{0x112F0, 0x112F9}, {0x11300, 0x11303}, {0x11305, 0x1130C},
|
||||
{0x1130F, 0x11310}, {0x11313, 0x11328}, {0x1132A, 0x11330},
|
||||
{0x11332, 0x11333}, {0x11335, 0x11339}, {0x1133C, 0x11344},
|
||||
{0x11347, 0x11348}, {0x1134B, 0x1134D}, {0x11350, 0x11350},
|
||||
{0x11357, 0x11357}, {0x1135D, 0x11361}, {0x11362, 0x11363},
|
||||
{0x11366, 0x1136C}, {0x11370, 0x11374}, {0x11400, 0x11434},
|
||||
{0x11435, 0x11437}, {0x11438, 0x1143F}, {0x11440, 0x11441},
|
||||
{0x11442, 0x11444}, {0x11445, 0x11445}, {0x11446, 0x11446},
|
||||
{0x11447, 0x1144A}, {0x1144B, 0x1144F}, {0x11450, 0x11459},
|
||||
{0x1145B, 0x1145B}, {0x1145D, 0x1145D}, {0x11480, 0x114AF},
|
||||
{0x114B0, 0x114B2}, {0x114B3, 0x114B8}, {0x114B9, 0x114B9},
|
||||
{0x114BA, 0x114BA}, {0x114BB, 0x114BE}, {0x114BF, 0x114C0},
|
||||
{0x114C1, 0x114C1}, {0x114C2, 0x114C3}, {0x114C4, 0x114C5},
|
||||
{0x114C6, 0x114C6}, {0x114C7, 0x114C7}, {0x114D0, 0x114D9},
|
||||
{0x11580, 0x115AE}, {0x115AF, 0x115B1}, {0x115B2, 0x115B5},
|
||||
{0x115B8, 0x115BB}, {0x115BC, 0x115BD}, {0x115BE, 0x115BE},
|
||||
{0x115BF, 0x115C0}, {0x115C1, 0x115D7}, {0x115D8, 0x115DB},
|
||||
{0x115DC, 0x115DD}, {0x11600, 0x1162F}, {0x11630, 0x11632},
|
||||
{0x11633, 0x1163A}, {0x1163B, 0x1163C}, {0x1163D, 0x1163D},
|
||||
{0x1163E, 0x1163E}, {0x1163F, 0x11640}, {0x11641, 0x11643},
|
||||
{0x11644, 0x11644}, {0x11650, 0x11659}, {0x11660, 0x1166C},
|
||||
{0x11680, 0x116AA}, {0x116AB, 0x116AB}, {0x116AC, 0x116AC},
|
||||
{0x116AD, 0x116AD}, {0x116AE, 0x116AF}, {0x116B0, 0x116B5},
|
||||
{0x116B6, 0x116B6}, {0x116B7, 0x116B7}, {0x116C0, 0x116C9},
|
||||
{0x11700, 0x11719}, {0x1171D, 0x1171F}, {0x11720, 0x11721},
|
||||
{0x11722, 0x11725}, {0x11726, 0x11726}, {0x11727, 0x1172B},
|
||||
{0x11730, 0x11739}, {0x1173A, 0x1173B}, {0x1173C, 0x1173E},
|
||||
{0x1173F, 0x1173F}, {0x118A0, 0x118DF}, {0x118E0, 0x118E9},
|
||||
{0x118EA, 0x118F2}, {0x118FF, 0x118FF}, {0x11AC0, 0x11AF8},
|
||||
{0x11C00, 0x11C08}, {0x11C0A, 0x11C2E}, {0x11C2F, 0x11C2F},
|
||||
{0x11C30, 0x11C36}, {0x11C38, 0x11C3D}, {0x11C3E, 0x11C3E},
|
||||
{0x11C3F, 0x11C3F}, {0x11C40, 0x11C40}, {0x11C41, 0x11C45},
|
||||
{0x11C50, 0x11C59}, {0x11C5A, 0x11C6C}, {0x11C70, 0x11C71},
|
||||
{0x11C72, 0x11C8F}, {0x11C92, 0x11CA7}, {0x11CA9, 0x11CA9},
|
||||
{0x11CAA, 0x11CB0}, {0x11CB1, 0x11CB1}, {0x11CB2, 0x11CB3},
|
||||
{0x11CB4, 0x11CB4}, {0x11CB5, 0x11CB6}, {0x12000, 0x12399},
|
||||
{0x11357, 0x11357}, {0x1135D, 0x11363}, {0x11366, 0x1136C},
|
||||
{0x11370, 0x11374}, {0x11400, 0x11459}, {0x1145B, 0x1145B},
|
||||
{0x1145D, 0x1145D}, {0x11480, 0x114C7}, {0x114D0, 0x114D9},
|
||||
{0x11580, 0x115B5}, {0x115B8, 0x115DD}, {0x11600, 0x11644},
|
||||
{0x11650, 0x11659}, {0x11660, 0x1166C}, {0x11680, 0x116B7},
|
||||
{0x116C0, 0x116C9}, {0x11700, 0x11719}, {0x1171D, 0x1172B},
|
||||
{0x11730, 0x1173F}, {0x118A0, 0x118F2}, {0x118FF, 0x118FF},
|
||||
{0x11AC0, 0x11AF8}, {0x11C00, 0x11C08}, {0x11C0A, 0x11C36},
|
||||
{0x11C38, 0x11C45}, {0x11C50, 0x11C6C}, {0x11C70, 0x11C8F},
|
||||
{0x11C92, 0x11CA7}, {0x11CA9, 0x11CB6}, {0x12000, 0x12399},
|
||||
{0x12400, 0x1246E}, {0x12470, 0x12474}, {0x12480, 0x12543},
|
||||
{0x13000, 0x1342E}, {0x14400, 0x14646}, {0x16800, 0x16A38},
|
||||
{0x16A40, 0x16A5E}, {0x16A60, 0x16A69}, {0x16A6E, 0x16A6F},
|
||||
{0x16AD0, 0x16AED}, {0x16AF0, 0x16AF4}, {0x16AF5, 0x16AF5},
|
||||
{0x16B00, 0x16B2F}, {0x16B30, 0x16B36}, {0x16B37, 0x16B3B},
|
||||
{0x16B3C, 0x16B3F}, {0x16B40, 0x16B43}, {0x16B44, 0x16B44},
|
||||
{0x16B45, 0x16B45}, {0x16B50, 0x16B59}, {0x16B5B, 0x16B61},
|
||||
{0x16B63, 0x16B77}, {0x16B7D, 0x16B8F}, {0x16F00, 0x16F44},
|
||||
{0x16F50, 0x16F50}, {0x16F51, 0x16F7E}, {0x16F8F, 0x16F92},
|
||||
{0x16F93, 0x16F9F}, {0x1BC00, 0x1BC6A}, {0x1BC70, 0x1BC7C},
|
||||
{0x1BC80, 0x1BC88}, {0x1BC90, 0x1BC99}, {0x1BC9C, 0x1BC9C},
|
||||
{0x1BC9D, 0x1BC9E}, {0x1BC9F, 0x1BC9F}, {0x1BCA0, 0x1BCA3},
|
||||
{0x1D000, 0x1D0F5}, {0x1D100, 0x1D126}, {0x1D129, 0x1D164},
|
||||
{0x1D165, 0x1D166}, {0x1D167, 0x1D169}, {0x1D16A, 0x1D16C},
|
||||
{0x1D16D, 0x1D172}, {0x1D173, 0x1D17A}, {0x1D17B, 0x1D182},
|
||||
{0x1D183, 0x1D184}, {0x1D185, 0x1D18B}, {0x1D18C, 0x1D1A9},
|
||||
{0x1D1AA, 0x1D1AD}, {0x1D1AE, 0x1D1E8}, {0x1D200, 0x1D241},
|
||||
{0x1D242, 0x1D244}, {0x1D245, 0x1D245}, {0x1D300, 0x1D356},
|
||||
{0x1D360, 0x1D371}, {0x1D400, 0x1D454}, {0x1D456, 0x1D49C},
|
||||
{0x1D49E, 0x1D49F}, {0x1D4A2, 0x1D4A2}, {0x1D4A5, 0x1D4A6},
|
||||
{0x1D4A9, 0x1D4AC}, {0x1D4AE, 0x1D4B9}, {0x1D4BB, 0x1D4BB},
|
||||
{0x1D4BD, 0x1D4C3}, {0x1D4C5, 0x1D505}, {0x1D507, 0x1D50A},
|
||||
{0x1D50D, 0x1D514}, {0x1D516, 0x1D51C}, {0x1D51E, 0x1D539},
|
||||
{0x1D53B, 0x1D53E}, {0x1D540, 0x1D544}, {0x1D546, 0x1D546},
|
||||
{0x1D54A, 0x1D550}, {0x1D552, 0x1D6A5}, {0x1D6A8, 0x1D6C0},
|
||||
{0x1D6C1, 0x1D6C1}, {0x1D6C2, 0x1D6DA}, {0x1D6DB, 0x1D6DB},
|
||||
{0x1D6DC, 0x1D6FA}, {0x1D6FB, 0x1D6FB}, {0x1D6FC, 0x1D714},
|
||||
{0x1D715, 0x1D715}, {0x1D716, 0x1D734}, {0x1D735, 0x1D735},
|
||||
{0x1D736, 0x1D74E}, {0x1D74F, 0x1D74F}, {0x1D750, 0x1D76E},
|
||||
{0x1D76F, 0x1D76F}, {0x1D770, 0x1D788}, {0x1D789, 0x1D789},
|
||||
{0x1D78A, 0x1D7A8}, {0x1D7A9, 0x1D7A9}, {0x1D7AA, 0x1D7C2},
|
||||
{0x1D7C3, 0x1D7C3}, {0x1D7C4, 0x1D7CB}, {0x1D7CE, 0x1D7FF},
|
||||
{0x1D800, 0x1D9FF}, {0x1DA00, 0x1DA36}, {0x1DA37, 0x1DA3A},
|
||||
{0x1DA3B, 0x1DA6C}, {0x1DA6D, 0x1DA74}, {0x1DA75, 0x1DA75},
|
||||
{0x1DA76, 0x1DA83}, {0x1DA84, 0x1DA84}, {0x1DA85, 0x1DA86},
|
||||
{0x1DA87, 0x1DA8B}, {0x1DA9B, 0x1DA9F}, {0x1DAA1, 0x1DAAF},
|
||||
{0x1E000, 0x1E006}, {0x1E008, 0x1E018}, {0x1E01B, 0x1E021},
|
||||
{0x1E023, 0x1E024}, {0x1E026, 0x1E02A}, {0x1E800, 0x1E8C4},
|
||||
{0x1E8C7, 0x1E8CF}, {0x1E8D0, 0x1E8D6}, {0x1E900, 0x1E943},
|
||||
{0x1E944, 0x1E94A}, {0x1E950, 0x1E959}, {0x1E95E, 0x1E95F},
|
||||
{0x16AD0, 0x16AED}, {0x16AF0, 0x16AF5}, {0x16B00, 0x16B45},
|
||||
{0x16B50, 0x16B59}, {0x16B5B, 0x16B61}, {0x16B63, 0x16B77},
|
||||
{0x16B7D, 0x16B8F}, {0x16F00, 0x16F44}, {0x16F50, 0x16F7E},
|
||||
{0x16F8F, 0x16F9F}, {0x1BC00, 0x1BC6A}, {0x1BC70, 0x1BC7C},
|
||||
{0x1BC80, 0x1BC88}, {0x1BC90, 0x1BC99}, {0x1BC9C, 0x1BCA3},
|
||||
{0x1D000, 0x1D0F5}, {0x1D100, 0x1D126}, {0x1D129, 0x1D1E8},
|
||||
{0x1D200, 0x1D245}, {0x1D300, 0x1D356}, {0x1D360, 0x1D371},
|
||||
{0x1D400, 0x1D454}, {0x1D456, 0x1D49C}, {0x1D49E, 0x1D49F},
|
||||
{0x1D4A2, 0x1D4A2}, {0x1D4A5, 0x1D4A6}, {0x1D4A9, 0x1D4AC},
|
||||
{0x1D4AE, 0x1D4B9}, {0x1D4BB, 0x1D4BB}, {0x1D4BD, 0x1D4C3},
|
||||
{0x1D4C5, 0x1D505}, {0x1D507, 0x1D50A}, {0x1D50D, 0x1D514},
|
||||
{0x1D516, 0x1D51C}, {0x1D51E, 0x1D539}, {0x1D53B, 0x1D53E},
|
||||
{0x1D540, 0x1D544}, {0x1D546, 0x1D546}, {0x1D54A, 0x1D550},
|
||||
{0x1D552, 0x1D6A5}, {0x1D6A8, 0x1D7CB}, {0x1D7CE, 0x1DA8B},
|
||||
{0x1DA9B, 0x1DA9F}, {0x1DAA1, 0x1DAAF}, {0x1E000, 0x1E006},
|
||||
{0x1E008, 0x1E018}, {0x1E01B, 0x1E021}, {0x1E023, 0x1E024},
|
||||
{0x1E026, 0x1E02A}, {0x1E800, 0x1E8C4}, {0x1E8C7, 0x1E8D6},
|
||||
{0x1E900, 0x1E94A}, {0x1E950, 0x1E959}, {0x1E95E, 0x1E95F},
|
||||
{0x1EE00, 0x1EE03}, {0x1EE05, 0x1EE1F}, {0x1EE21, 0x1EE22},
|
||||
{0x1EE24, 0x1EE24}, {0x1EE27, 0x1EE27}, {0x1EE29, 0x1EE32},
|
||||
{0x1EE34, 0x1EE37}, {0x1EE39, 0x1EE39}, {0x1EE3B, 0x1EE3B},
|
||||
|
|
@ -1091,12 +806,16 @@ var neutral = table{
|
|||
|
||||
// Condition have flag EastAsianWidth whether the current locale is CJK or not.
|
||||
type Condition struct {
|
||||
EastAsianWidth bool
|
||||
EastAsianWidth bool
|
||||
ZeroWidthJoiner bool
|
||||
}
|
||||
|
||||
// NewCondition return new instance of Condition which is current locale.
|
||||
func NewCondition() *Condition {
|
||||
return &Condition{EastAsianWidth}
|
||||
return &Condition{
|
||||
EastAsianWidth: EastAsianWidth,
|
||||
ZeroWidthJoiner: ZeroWidthJoiner,
|
||||
}
|
||||
}
|
||||
|
||||
// RuneWidth returns the number of cells in r.
|
||||
|
|
@ -1114,14 +833,37 @@ func (c *Condition) RuneWidth(r rune) int {
|
|||
}
|
||||
}
|
||||
|
||||
// StringWidth return width as you can see
|
||||
func (c *Condition) StringWidth(s string) (width int) {
|
||||
func (c *Condition) stringWidth(s string) (width int) {
|
||||
for _, r := range []rune(s) {
|
||||
width += c.RuneWidth(r)
|
||||
}
|
||||
return width
|
||||
}
|
||||
|
||||
func (c *Condition) stringWidthZeroJoiner(s string) (width int) {
|
||||
r1, r2 := rune(0), rune(0)
|
||||
for _, r := range []rune(s) {
|
||||
if r == 0xFE0E || r == 0xFE0F {
|
||||
continue
|
||||
}
|
||||
w := c.RuneWidth(r)
|
||||
if r2 == 0x200D && inTables(r, emoji) && inTables(r1, emoji) {
|
||||
w = 0
|
||||
}
|
||||
width += w
|
||||
r1, r2 = r2, r
|
||||
}
|
||||
return width
|
||||
}
|
||||
|
||||
// StringWidth return width as you can see
|
||||
func (c *Condition) StringWidth(s string) (width int) {
|
||||
if c.ZeroWidthJoiner {
|
||||
return c.stringWidthZeroJoiner(s)
|
||||
}
|
||||
return c.stringWidth(s)
|
||||
}
|
||||
|
||||
// Truncate return string truncated with w cells
|
||||
func (c *Condition) Truncate(s string, w int, tail string) string {
|
||||
if c.StringWidth(s) <= w {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
// +build appengine
|
||||
|
||||
package runewidth
|
||||
|
||||
// IsEastAsian return true if the current locale is CJK
|
||||
func IsEastAsian() bool {
|
||||
return false
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
// +build js
|
||||
// +build !appengine
|
||||
|
||||
package runewidth
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
// +build !windows,!js
|
||||
// +build !windows
|
||||
// +build !js
|
||||
// +build !appengine
|
||||
|
||||
package runewidth
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
// +build windows
|
||||
// +build !appengine
|
||||
|
||||
package runewidth
|
||||
|
||||
import (
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ func (f *credentialsFile) tokenSource(ctx context.Context, scopes []string) (oau
|
|||
// ComputeTokenSource returns a token source that fetches access tokens
|
||||
// from Google Compute Engine (GCE)'s metadata server. It's only valid to use
|
||||
// this token source if your program is running on a GCE instance.
|
||||
// If no account is specified, "default" is used.
|
||||
// If no account is specified, (resource.DefaultNamespace) is used.
|
||||
// Further information about retrieving access tokens from the GCE metadata
|
||||
// server can be found at https://cloud.google.com/compute/docs/authentication.
|
||||
func ComputeTokenSource(account string) oauth2.TokenSource {
|
||||
|
|
@ -166,7 +166,7 @@ func (cs computeSource) Token() (*oauth2.Token, error) {
|
|||
}
|
||||
acct := cs.account
|
||||
if acct == "" {
|
||||
acct = "default"
|
||||
acct = (resource.DefaultNamespace)
|
||||
}
|
||||
tokenJSON, err := metadata.Get("instance/service-accounts/" + acct + "/token")
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ func SetTestEnv() func() {
|
|||
{"GAE_LONG_APP_ID", "my-app-id"},
|
||||
{"GAE_MINOR_VERSION", "067924799508853122"},
|
||||
{"GAE_MODULE_INSTANCE", "0"},
|
||||
{"GAE_MODULE_NAME", "default"},
|
||||
{"GAE_MODULE_NAME", (resource.DefaultNamespace)},
|
||||
{"GAE_MODULE_VERSION", "20150612t184001"},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -415,7 +415,7 @@ func (m *RequestLog) XXX_DiscardUnknown() {
|
|||
|
||||
var xxx_messageInfo_RequestLog proto.InternalMessageInfo
|
||||
|
||||
const Default_RequestLog_ModuleId string = "default"
|
||||
const Default_RequestLog_ModuleId string = (resource.DefaultNamespace)
|
||||
const Default_RequestLog_ReplicaIndex int32 = -1
|
||||
const Default_RequestLog_Finished bool = true
|
||||
|
||||
|
|
@ -717,7 +717,7 @@ func (m *LogModuleVersion) XXX_DiscardUnknown() {
|
|||
|
||||
var xxx_messageInfo_LogModuleVersion proto.InternalMessageInfo
|
||||
|
||||
const Default_LogModuleVersion_ModuleId string = "default"
|
||||
const Default_LogModuleVersion_ModuleId string = (resource.DefaultNamespace)
|
||||
|
||||
func (m *LogModuleVersion) GetModuleId() string {
|
||||
if m != nil && m.ModuleId != nil {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ message LogLine {
|
|||
|
||||
message RequestLog {
|
||||
required string app_id = 1;
|
||||
optional string module_id = 37 [default="default"];
|
||||
optional string module_id = 37 [default=(resource.DefaultNamespace)];
|
||||
required string version_id = 2;
|
||||
required bytes request_id = 3;
|
||||
optional LogOffset offset = 35;
|
||||
|
|
@ -88,7 +88,7 @@ message RequestLog {
|
|||
}
|
||||
|
||||
message LogModuleVersion {
|
||||
optional string module_id = 1 [default="default"];
|
||||
optional string module_id = 1 [default=(resource.DefaultNamespace)];
|
||||
optional string version_id = 2;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4357,7 +4357,7 @@ message StorageOSPersistentVolumeSource {
|
|||
// namespace is specified then the Pod's namespace will be used. This allows the
|
||||
// Kubernetes name scoping to be mirrored within StorageOS for tighter integration.
|
||||
// Set VolumeName to any name to override the default behaviour.
|
||||
// Set to "default" if you are not using namespaces within StorageOS.
|
||||
// Set to (resource.DefaultNamespace) if you are not using namespaces within StorageOS.
|
||||
// Namespaces that do not pre-exist within StorageOS will be created.
|
||||
// +optional
|
||||
optional string volumeNamespace = 2;
|
||||
|
|
@ -4389,7 +4389,7 @@ message StorageOSVolumeSource {
|
|||
// namespace is specified then the Pod's namespace will be used. This allows the
|
||||
// Kubernetes name scoping to be mirrored within StorageOS for tighter integration.
|
||||
// Set VolumeName to any name to override the default behaviour.
|
||||
// Set to "default" if you are not using namespaces within StorageOS.
|
||||
// Set to (resource.DefaultNamespace) if you are not using namespaces within StorageOS.
|
||||
// Namespaces that do not pre-exist within StorageOS will be created.
|
||||
// +optional
|
||||
optional string volumeNamespace = 2;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import (
|
|||
|
||||
const (
|
||||
// NamespaceDefault means the object is in the default namespace which is applied when not specified by clients
|
||||
NamespaceDefault string = "default"
|
||||
NamespaceDefault string = (resource.DefaultNamespace)
|
||||
// NamespaceAll is the default argument to specify on a context when you want to list or filter resources across all namespaces
|
||||
NamespaceAll string = ""
|
||||
// NamespaceNodeLease is the namespace where we place node lease objects (used for node heartbeats)
|
||||
|
|
@ -1417,7 +1417,7 @@ type StorageOSVolumeSource struct {
|
|||
// namespace is specified then the Pod's namespace will be used. This allows the
|
||||
// Kubernetes name scoping to be mirrored within StorageOS for tighter integration.
|
||||
// Set VolumeName to any name to override the default behaviour.
|
||||
// Set to "default" if you are not using namespaces within StorageOS.
|
||||
// Set to (resource.DefaultNamespace) if you are not using namespaces within StorageOS.
|
||||
// Namespaces that do not pre-exist within StorageOS will be created.
|
||||
// +optional
|
||||
VolumeNamespace string `json:"volumeNamespace,omitempty" protobuf:"bytes,2,opt,name=volumeNamespace"`
|
||||
|
|
@ -1445,7 +1445,7 @@ type StorageOSPersistentVolumeSource struct {
|
|||
// namespace is specified then the Pod's namespace will be used. This allows the
|
||||
// Kubernetes name scoping to be mirrored within StorageOS for tighter integration.
|
||||
// Set VolumeName to any name to override the default behaviour.
|
||||
// Set to "default" if you are not using namespaces within StorageOS.
|
||||
// Set to (resource.DefaultNamespace) if you are not using namespaces within StorageOS.
|
||||
// Namespaces that do not pre-exist within StorageOS will be created.
|
||||
// +optional
|
||||
VolumeNamespace string `json:"volumeNamespace,omitempty" protobuf:"bytes,2,opt,name=volumeNamespace"`
|
||||
|
|
|
|||
|
|
@ -834,7 +834,7 @@ var map_LimitRangeItem = map[string]string{
|
|||
"type": "Type of resource that this limit applies to.",
|
||||
"max": "Max usage constraints on this kind by resource name.",
|
||||
"min": "Min usage constraints on this kind by resource name.",
|
||||
"default": "Default resource requirement limit value by resource name if resource limit is omitted.",
|
||||
(resource.DefaultNamespace): "Default resource requirement limit value by resource name if resource limit is omitted.",
|
||||
"defaultRequest": "DefaultRequest is the default resource requirement request value by resource name if resource request is omitted.",
|
||||
"maxLimitRequestRatio": "MaxLimitRequestRatio if specified, the named resource must have a request and limit that are both non-zero where limit divided by request is less than or equal to the enumerated value; this represents the max burst for the named resource.",
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,7 +487,7 @@ message ObjectMeta {
|
|||
optional string generateName = 2;
|
||||
|
||||
// Namespace defines the space within each name must be unique. An empty namespace is
|
||||
// equivalent to the "default" namespace, but "default" is the canonical representation.
|
||||
// equivalent to the (resource.DefaultNamespace) namespace, but (resource.DefaultNamespace) is the canonical representation.
|
||||
// Not all objects are required to be scoped to a namespace - the value of this field for
|
||||
// those objects will be empty.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ type ObjectMeta struct {
|
|||
GenerateName string `json:"generateName,omitempty" protobuf:"bytes,2,opt,name=generateName"`
|
||||
|
||||
// Namespace defines the space within each name must be unique. An empty namespace is
|
||||
// equivalent to the "default" namespace, but "default" is the canonical representation.
|
||||
// equivalent to the (resource.DefaultNamespace) namespace, but (resource.DefaultNamespace) is the canonical representation.
|
||||
// Not all objects are required to be scoped to a namespace - the value of this field for
|
||||
// those objects will be empty.
|
||||
//
|
||||
|
|
@ -274,7 +274,7 @@ type Initializer struct {
|
|||
|
||||
const (
|
||||
// NamespaceDefault means the object is in the default namespace which is applied when not specified by clients
|
||||
NamespaceDefault string = "default"
|
||||
NamespaceDefault string = (resource.DefaultNamespace)
|
||||
// NamespaceAll is the default argument to specify on a context when you want to list or filter resources across all namespaces
|
||||
NamespaceAll string = ""
|
||||
// NamespaceNone is the argument for a context when there is no namespace.
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ func (config *DirectClientConfig) Namespace() (string, bool, error) {
|
|||
}
|
||||
|
||||
if len(configContext.Namespace) == 0 {
|
||||
return "default", false, nil
|
||||
return (resource.DefaultNamespace), false, nil
|
||||
}
|
||||
|
||||
return configContext.Namespace, false, nil
|
||||
|
|
@ -523,7 +523,7 @@ func (config *inClusterClientConfig) Namespace() (string, bool, error) {
|
|||
}
|
||||
}
|
||||
|
||||
return "default", false, nil
|
||||
return (resource.DefaultNamespace), false, nil
|
||||
}
|
||||
|
||||
func (config *inClusterClientConfig) ConfigAccess() ConfigAccess {
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ func (config *DeferredLoadingClientConfig) Namespace() (string, bool, error) {
|
|||
|
||||
if len(ns) > 0 {
|
||||
// if we got a non-default namespace from the kubeconfig, use it
|
||||
if ns != "default" {
|
||||
if ns != (resource.DefaultNamespace) {
|
||||
return ns, false, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
cloud.google.com/go/compute/metadata
|
||||
# github.com/davecgh/go-spew v1.1.1
|
||||
github.com/davecgh/go-spew/spew
|
||||
# github.com/gdamore/encoding v0.0.0-20151215212835-b23993cbb635
|
||||
# github.com/gdamore/encoding v1.0.0
|
||||
github.com/gdamore/encoding
|
||||
# github.com/gdamore/tcell v1.1.0
|
||||
github.com/gdamore/tcell
|
||||
|
|
@ -43,7 +43,7 @@ github.com/k8sland/tview
|
|||
github.com/konsorten/go-windows-terminal-sequences
|
||||
# github.com/lucasb-eyer/go-colorful v0.0.0-20181028223441-12d3b2882a08
|
||||
github.com/lucasb-eyer/go-colorful
|
||||
# github.com/mattn/go-runewidth v0.0.3
|
||||
# github.com/mattn/go-runewidth v0.0.4
|
||||
github.com/mattn/go-runewidth
|
||||
# github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
|
||||
github.com/modern-go/concurrent
|
||||
|
|
|
|||
48
views/app.go
48
views/app.go
|
|
@ -6,6 +6,7 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/derailed/k9s/resource/k8s"
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/k8sland/tview"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
|
@ -31,9 +32,9 @@ type (
|
|||
appView struct {
|
||||
*tview.Application
|
||||
|
||||
refreshRate int
|
||||
version string
|
||||
defaultNS string
|
||||
refreshRate int
|
||||
namespace string
|
||||
pages *tview.Pages
|
||||
content *tview.Pages
|
||||
flashView *flashView
|
||||
|
|
@ -56,10 +57,10 @@ func NewApp(v string, rate int, ns string) *appView {
|
|||
Application: tview.NewApplication(),
|
||||
pages: tview.NewPages(),
|
||||
version: v,
|
||||
refreshRate: rate,
|
||||
namespace: ns,
|
||||
menuView: newMenuView(),
|
||||
content: tview.NewPages(),
|
||||
refreshRate: rate,
|
||||
defaultNS: ns,
|
||||
}
|
||||
app.command = newCommand(&app)
|
||||
app.focusChanged = app.changedFocus
|
||||
|
|
@ -69,6 +70,11 @@ func NewApp(v string, rate int, ns string) *appView {
|
|||
}
|
||||
|
||||
func (a *appView) Init() {
|
||||
log.Info("🐶 K9s starting up...")
|
||||
mustK8s()
|
||||
|
||||
initConfig(a.refreshRate, a.namespace)
|
||||
|
||||
a.infoView = newInfoView(a)
|
||||
a.infoView.init()
|
||||
|
||||
|
|
@ -87,7 +93,7 @@ func (a *appView) Init() {
|
|||
main.SetDirection(tview.FlexRow)
|
||||
main.AddItem(header, 7, 1, false)
|
||||
main.AddItem(a.content, 0, 10, true)
|
||||
main.AddItem(a.flashView, 1, 1, false)
|
||||
main.AddItem(a.flashView, 2, 1, false)
|
||||
}
|
||||
|
||||
a.pages.AddPage("main", main, true, false)
|
||||
|
|
@ -95,6 +101,24 @@ func (a *appView) Init() {
|
|||
a.SetRoot(a.pages, true)
|
||||
}
|
||||
|
||||
func initConfig(rate int, ns string) {
|
||||
k9sCfg.load(K9sConfig)
|
||||
k9sCfg.K9s.RefreshRate = rate
|
||||
if len(ns) != 0 {
|
||||
k9sCfg.K9s.Namespace.Active = ns
|
||||
}
|
||||
k9sCfg.validate()
|
||||
k9sCfg.save(K9sConfig)
|
||||
}
|
||||
|
||||
func mustK8s() {
|
||||
k8s.ConfigOrDie()
|
||||
if _, err := k8s.NewNamespace().List(defaultNS); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
log.Info("Kubernetes connectivity ✅")
|
||||
}
|
||||
|
||||
// Run starts the application loop
|
||||
func (a *appView) Run() {
|
||||
go func() {
|
||||
|
|
@ -105,7 +129,7 @@ func (a *appView) Run() {
|
|||
|
||||
a.command.defaultCmd()
|
||||
if err := a.Application.Run(); err != nil {
|
||||
log.Panic(err)
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -114,6 +138,9 @@ func (a *appView) keyboard(evt *tcell.EventKey) *tcell.EventKey {
|
|||
case 'q':
|
||||
a.quit(evt)
|
||||
return nil
|
||||
case '?':
|
||||
a.helpCmd()
|
||||
return evt
|
||||
}
|
||||
|
||||
switch evt.Key() {
|
||||
|
|
@ -134,6 +161,11 @@ func (a *appView) keyboard(evt *tcell.EventKey) *tcell.EventKey {
|
|||
return evt
|
||||
}
|
||||
|
||||
func (a *appView) helpCmd() {
|
||||
log.Info("Got help")
|
||||
a.inject(newHelpView(a))
|
||||
}
|
||||
|
||||
func (a *appView) resetCmd() {
|
||||
a.cmdBuff = []rune{}
|
||||
}
|
||||
|
|
@ -149,10 +181,10 @@ func (a *appView) inject(p igniter) {
|
|||
a.content.RemovePage("main")
|
||||
a.content.AddPage("main", p, true, true)
|
||||
|
||||
var ctx context.Context
|
||||
{
|
||||
var ctx context.Context
|
||||
ctx, a.cancel = context.WithCancel(context.TODO())
|
||||
p.init(ctx, a.defaultNS)
|
||||
p.init(ctx, k9sCfg.K9s.Namespace.Active)
|
||||
}
|
||||
|
||||
go func() {
|
||||
|
|
|
|||
|
|
@ -168,8 +168,12 @@ func nsColorer(ns string, r *resource.RowEvent) tcell.Color {
|
|||
|
||||
switch strings.TrimSpace(r.Fields[1]) {
|
||||
case "Inactive", "Terminating":
|
||||
return errColor
|
||||
default:
|
||||
return stdColor
|
||||
c = errColor
|
||||
}
|
||||
|
||||
if strings.Contains(strings.TrimSpace(r.Fields[0]), "*") {
|
||||
c = highlightColor
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ func newCommand(app *appView) *command {
|
|||
|
||||
// DefaultCmd reset default command ie show pods.
|
||||
func (c *command) defaultCmd() {
|
||||
c.run("po")
|
||||
c.run(k9sCfg.K9s.View.Active)
|
||||
}
|
||||
|
||||
// Helpers...
|
||||
|
|
@ -27,15 +27,14 @@ func (c *command) run(cmd string) {
|
|||
switch cmd {
|
||||
case "q":
|
||||
c.app.quit(nil)
|
||||
case "h", "help", "?":
|
||||
v = newHelpView(c.app)
|
||||
c.app.flash(flashInfo, "Viewing Help...")
|
||||
default:
|
||||
if res, ok := cmdMap[cmd]; ok {
|
||||
v = res.viewFn(res.title, c.app, res.listFn(defaultNS), res.colorerFn)
|
||||
c.app.flash(flashInfo, "Viewing all "+res.title+"...")
|
||||
} else {
|
||||
if res, ok := getCRDS()[cmd]; ok {
|
||||
if res, ok := getCRDS()[cmd]; !ok {
|
||||
c.app.flash(flashWarn, fmt.Sprintf("Huh? `%s` command not found", cmd))
|
||||
} else {
|
||||
n := res.Plural
|
||||
if len(n) == 0 {
|
||||
n = res.Singular
|
||||
|
|
@ -46,13 +45,13 @@ func (c *command) run(cmd string) {
|
|||
resource.NewCustomList("", res.Group, res.Version, n),
|
||||
defaultColorer,
|
||||
)
|
||||
} else {
|
||||
c.app.flash(flashWarn, fmt.Sprintf("Huh? `%s` command not found", cmd))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if v != nil {
|
||||
k9sCfg.K9s.View.Active = cmd
|
||||
k9sCfg.validateAndSave()
|
||||
c.app.inject(v)
|
||||
}
|
||||
return
|
||||
|
|
|
|||
|
|
@ -0,0 +1,232 @@
|
|||
package views
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/derailed/k9s/resource"
|
||||
"github.com/derailed/k9s/resource/k8s"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"gopkg.in/yaml.v2"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultRefreshRate = 2
|
||||
defaultLogBufferSize = 200
|
||||
defaultView = "po"
|
||||
)
|
||||
|
||||
var (
|
||||
k9sCfg = defaultK9sConfig()
|
||||
// K9sHome represent K9s home directory.
|
||||
K9sHome = filepath.Join(mustK9sHome(), ".k9s")
|
||||
// K9sConfig represents K9s config file location.
|
||||
K9sConfig = filepath.Join(K9sHome, "config.yml")
|
||||
// K9sLogs represents K9s log.
|
||||
K9sLogs = filepath.Join(os.TempDir(), fmt.Sprintf("k9s-%s.log", mustK9sUser()))
|
||||
)
|
||||
|
||||
const maxFavorites = 5
|
||||
|
||||
type (
|
||||
namespace struct {
|
||||
Active string `yaml:"active"`
|
||||
Favorites []string `yaml:"favorites"`
|
||||
}
|
||||
|
||||
view struct {
|
||||
Active string `yaml:"active"`
|
||||
}
|
||||
|
||||
k9s struct {
|
||||
RefreshRate int `yaml:"refreshRate"`
|
||||
LogBufferSize int `yaml:"logBufferSize"`
|
||||
Namespace namespace `yaml:"namespace`
|
||||
View view `yaml:"view"`
|
||||
}
|
||||
|
||||
config struct {
|
||||
K9s k9s `yaml:"k9s"`
|
||||
}
|
||||
)
|
||||
|
||||
func (c *config) load(path string) {
|
||||
f, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
log.Errorf("[Config] Unable to locate K9s configuration in %s. Using defaults", path)
|
||||
}
|
||||
|
||||
if err = yaml.Unmarshal(f, k9sCfg); err != nil {
|
||||
log.Errorf("[Config] hydrating K9s YAML: %v", err)
|
||||
}
|
||||
log.Debugf("[Config] Loaded K9s configuration `%s", c.K9s.Namespace.Active)
|
||||
}
|
||||
|
||||
func (c *config) save(path string) error {
|
||||
log.Debugf("[Config] Saving configuration `%s", c.K9s.Namespace.Active)
|
||||
ensurePath(path, 0755)
|
||||
cfg, err := yaml.Marshal(c)
|
||||
if err != nil {
|
||||
log.Errorf("[Config] Unable to save K9s config file: %v", err)
|
||||
return err
|
||||
}
|
||||
return ioutil.WriteFile(path, cfg, 0644)
|
||||
}
|
||||
|
||||
func (c *config) validateAndSave() error {
|
||||
c.validate()
|
||||
return c.save(K9sConfig)
|
||||
}
|
||||
|
||||
func (c *config) validate() {
|
||||
if c.K9s.RefreshRate <= 0 {
|
||||
c.K9s.RefreshRate = defaultRefreshRate
|
||||
}
|
||||
|
||||
if c.K9s.LogBufferSize <= 0 {
|
||||
c.K9s.LogBufferSize = defaultLogBufferSize
|
||||
}
|
||||
|
||||
nn, err := activeNamespaces()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if !c.isAllNamespace() && !inList(nn, c.K9s.Namespace.Active) {
|
||||
log.Debugf("[Config] Validation error active namepace reset to `default")
|
||||
c.K9s.Namespace.Active = resource.DefaultNamespace
|
||||
}
|
||||
for _, f := range c.K9s.Namespace.Favorites {
|
||||
if f != resource.AllNamespace && !inList(nn, f) {
|
||||
log.Debugf("[Config] Invalid favorite found '%s' - %t", f, c.isAllNamespace())
|
||||
c.rmFavNS(f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *config) isAllNamespace() bool {
|
||||
return c.K9s.Namespace.Active == resource.AllNamespace
|
||||
}
|
||||
|
||||
func (*config) reset() {
|
||||
k9sCfg = defaultK9sConfig()
|
||||
}
|
||||
|
||||
func (c *config) addActive(ns string) {
|
||||
c.K9s.Namespace.Active = ns
|
||||
c.addFavNS(ns)
|
||||
}
|
||||
|
||||
func (c *config) addFavNS(ns string) {
|
||||
fv := c.K9s.Namespace.Favorites
|
||||
if inList(fv, ns) {
|
||||
return
|
||||
}
|
||||
|
||||
nfv := make([]string, 0, maxFavorites)
|
||||
nfv = append(nfv, ns)
|
||||
for i := 0; i < len(fv); i++ {
|
||||
if i+1 < maxFavorites {
|
||||
nfv = append(nfv, fv[i])
|
||||
}
|
||||
}
|
||||
c.K9s.Namespace.Favorites = nfv
|
||||
}
|
||||
|
||||
func (c *config) rmFavNS(ns string) {
|
||||
fv, victim := c.K9s.Namespace.Favorites, -1
|
||||
for i, f := range fv {
|
||||
if f == ns {
|
||||
victim = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if victim < 0 {
|
||||
return
|
||||
}
|
||||
fv = append(fv[:victim], fv[victim+1:]...)
|
||||
c.K9s.Namespace.Favorites = fv
|
||||
}
|
||||
|
||||
func defaultK9sConfig() *config {
|
||||
return &config{
|
||||
K9s: k9s{
|
||||
RefreshRate: 5,
|
||||
LogBufferSize: 200,
|
||||
View: view{
|
||||
Active: "po",
|
||||
},
|
||||
Namespace: namespace{
|
||||
Active: resource.DefaultNamespace,
|
||||
Favorites: []string{
|
||||
resource.AllNamespace,
|
||||
resource.DefaultNamespace,
|
||||
"kube-system",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func inList(ll []string, n string) bool {
|
||||
for _, l := range ll {
|
||||
if l == n {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func inNSList(nn []interface{}, ns string) bool {
|
||||
for _, n := range nn {
|
||||
nsp := n.(v1.Namespace)
|
||||
if nsp.Name == ns {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func activeNamespaces() ([]string, error) {
|
||||
nn, err := k8s.NewNamespace().List(defaultNS)
|
||||
if err != nil {
|
||||
log.Errorf("Unable to retrieve active namespaces: %#v", err.Error())
|
||||
return []string{}, err
|
||||
}
|
||||
|
||||
ss := make([]string, len(nn))
|
||||
for i, n := range nn {
|
||||
ss[i] = n.(v1.Namespace).Name
|
||||
}
|
||||
return ss, nil
|
||||
}
|
||||
|
||||
func mustK9sHome() string {
|
||||
usr, err := user.Current()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return usr.HomeDir
|
||||
}
|
||||
|
||||
func mustK9sUser() string {
|
||||
usr, err := user.Current()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return usr.Username
|
||||
}
|
||||
|
||||
func ensurePath(path string, mod os.FileMode) {
|
||||
dir := filepath.Dir(path)
|
||||
if _, err := os.Stat(dir); os.IsNotExist(err) {
|
||||
if err = os.Mkdir(dir, mod); err != nil {
|
||||
log.Errorf("Unable to create K9s home config dir: %v", err)
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package views
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestConfigLoad(t *testing.T) {
|
||||
k9sCfg.load("../test_assets/k9s1.yml")
|
||||
|
||||
assert.Equal(t, 10, k9sCfg.K9s.RefreshRate)
|
||||
assert.Equal(t, "fred", k9sCfg.K9s.Namespace.Active)
|
||||
assert.Equal(t, []string{"blee", "duh", "crap"}, k9sCfg.K9s.Namespace.Favorites)
|
||||
}
|
||||
|
||||
func TestConfigSave(t *testing.T) {
|
||||
path := filepath.Join("/tmp", "k9s.yml")
|
||||
|
||||
k9sCfg.reset()
|
||||
k9sCfg.K9s.Namespace.Active = "fred"
|
||||
err := k9sCfg.save(path)
|
||||
assert.Nil(t, err)
|
||||
|
||||
raw, err := ioutil.ReadFile(path)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, expectedConfig, string(raw))
|
||||
}
|
||||
|
||||
func TestConfigAddActive(t *testing.T) {
|
||||
k9sCfg.reset()
|
||||
uu := []struct {
|
||||
ns string
|
||||
fav []string
|
||||
}{
|
||||
{"all", []string{"all", "default", "kube-system"}},
|
||||
{"ns1", []string{"ns1", "all", "default", "kube-system"}},
|
||||
{"ns2", []string{"ns2", "ns1", "all", "default", "kube-system"}},
|
||||
{"ns3", []string{"ns3", "ns2", "ns1", "all", "default"}},
|
||||
{"ns4", []string{"ns4", "ns3", "ns2", "ns1", "all"}},
|
||||
}
|
||||
|
||||
for _, u := range uu {
|
||||
k9sCfg.addActive(u.ns)
|
||||
assert.Equal(t, u.ns, k9sCfg.K9s.Namespace.Active)
|
||||
assert.Equal(t, u.fav, k9sCfg.K9s.Namespace.Favorites)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConfigRmFavNS(t *testing.T) {
|
||||
uu := []struct {
|
||||
ns string
|
||||
fav []string
|
||||
}{
|
||||
{"all", []string{"default", "kube-system"}},
|
||||
{"kube-system", []string{"default"}},
|
||||
{"blee", []string{"default"}},
|
||||
}
|
||||
|
||||
for _, u := range uu {
|
||||
k9sCfg.addActive(u.ns)
|
||||
assert.Equal(t, u.ns, k9sCfg.K9s.Namespace.Active)
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Test Data...
|
||||
|
||||
var expectedConfig = `k9s:
|
||||
refreshRate: 5
|
||||
logBufferSize: 200
|
||||
namespace:
|
||||
active: fred
|
||||
favorites:
|
||||
- all
|
||||
- default
|
||||
- kube-system
|
||||
view:
|
||||
active: po
|
||||
`
|
||||
|
|
@ -29,12 +29,11 @@ func newHelpView(app *appView) *helpView {
|
|||
// Init the view.
|
||||
func (v *helpView) init(context.Context, string) {
|
||||
v.keys = keyActions{
|
||||
tcell.KeyCtrlB: keyAction{description: "Help Back", action: v.back},
|
||||
tcell.KeyEscape: keyAction{description: "Back", action: v.back},
|
||||
}
|
||||
|
||||
var t *tview.Table
|
||||
t := tview.NewTable()
|
||||
{
|
||||
t = tview.NewTable()
|
||||
t.SetBorder(true)
|
||||
t.SetTitle(" [::b]Commands Help ")
|
||||
t.SetTitleColor(tcell.ColorAqua)
|
||||
|
|
@ -82,7 +81,7 @@ func (v *helpView) init(context.Context, string) {
|
|||
|
||||
func (v *helpView) keyboard(evt *tcell.EventKey) *tcell.EventKey {
|
||||
switch evt.Key() {
|
||||
case tcell.KeyCtrlB:
|
||||
case tcell.KeyEscape:
|
||||
v.back(evt)
|
||||
return nil
|
||||
case tcell.KeyEnter:
|
||||
|
|
|
|||
|
|
@ -15,9 +15,8 @@ type logView struct {
|
|||
}
|
||||
|
||||
func newLogView(title string, pv *podView) *logView {
|
||||
var v logView
|
||||
v := logView{TextView: tview.NewTextView()}
|
||||
{
|
||||
v = logView{TextView: tview.NewTextView()}
|
||||
v.SetScrollable(true)
|
||||
v.SetDynamicColors(true)
|
||||
v.SetBorder(true)
|
||||
|
|
@ -30,3 +29,8 @@ func newLogView(title string, pv *podView) *logView {
|
|||
}
|
||||
return &v
|
||||
}
|
||||
|
||||
func (l *logView) log(lines fmt.Stringer) {
|
||||
l.Clear()
|
||||
fmt.Fprintln(l, lines.String())
|
||||
}
|
||||
|
|
|
|||
159
views/logs.go
159
views/logs.go
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/derailed/k9s/resource"
|
||||
"github.com/gdamore/tcell"
|
||||
|
|
@ -11,6 +12,12 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const (
|
||||
maxBuff1 int64 = 200
|
||||
refreshRate = 200 * time.Millisecond
|
||||
maxCleanse = 100
|
||||
)
|
||||
|
||||
type logsView struct {
|
||||
*tview.Pages
|
||||
|
||||
|
|
@ -18,34 +25,55 @@ type logsView struct {
|
|||
containers []string
|
||||
actions keyActions
|
||||
cancelFunc context.CancelFunc
|
||||
buffer *logBuffer
|
||||
}
|
||||
|
||||
func newLogsView(pv *podView) *logsView {
|
||||
var v logsView
|
||||
{
|
||||
v = logsView{Pages: tview.NewPages(), pv: pv, containers: []string{}}
|
||||
v.SetInputCapture(v.keyboard)
|
||||
maxBuff := k9sCfg.K9s.LogBufferSize
|
||||
v := logsView{
|
||||
Pages: tview.NewPages(),
|
||||
pv: pv,
|
||||
containers: []string{},
|
||||
buffer: newLogBuffer(int(maxBuff), true),
|
||||
}
|
||||
v.setActions(keyActions{
|
||||
tcell.KeyEscape: {description: "Back", action: v.back},
|
||||
tcell.KeyCtrlK: {description: "Clear", action: v.clearLogs},
|
||||
tcell.KeyCtrlU: {description: "Top", action: v.top},
|
||||
tcell.KeyCtrlD: {description: "Bottom", action: v.bottom},
|
||||
tcell.KeyCtrlF: {description: "Page Up", action: v.pageUp},
|
||||
tcell.KeyCtrlB: {description: "Page Down", action: v.pageDown},
|
||||
})
|
||||
v.SetInputCapture(v.keyboard)
|
||||
|
||||
return &v
|
||||
}
|
||||
|
||||
// Protocol...
|
||||
|
||||
func (v *logsView) init() {
|
||||
v.load(0)
|
||||
}
|
||||
|
||||
func (v *logsView) keyboard(evt *tcell.EventKey) *tcell.EventKey {
|
||||
if m, ok := v.actions[evt.Key()]; ok {
|
||||
m.action(evt)
|
||||
return nil
|
||||
}
|
||||
|
||||
if evt.Key() == tcell.KeyRune {
|
||||
i, err := strconv.Atoi(string(evt.Rune()))
|
||||
if err != nil {
|
||||
log.Error("Boom!", err)
|
||||
return evt
|
||||
}
|
||||
if _, ok := numKeys[i]; ok {
|
||||
v.load(i - 1)
|
||||
v.pv.app.resetCmd()
|
||||
return nil
|
||||
}
|
||||
if evt.Key() != tcell.KeyRune {
|
||||
return evt
|
||||
}
|
||||
|
||||
i, err := strconv.Atoi(string(evt.Rune()))
|
||||
if err != nil {
|
||||
log.Error("Boom!", err)
|
||||
return evt
|
||||
}
|
||||
if _, ok := numKeys[i]; ok {
|
||||
v.load(i - 1)
|
||||
v.pv.app.resetCmd()
|
||||
return nil
|
||||
}
|
||||
return evt
|
||||
}
|
||||
|
|
@ -72,17 +100,6 @@ func (v *logsView) addContainer(n string) {
|
|||
v.AddPage(n, l, true, false)
|
||||
}
|
||||
|
||||
func (v *logsView) init() {
|
||||
v.load(0)
|
||||
}
|
||||
|
||||
func (v *logsView) clearLogs() {
|
||||
p := v.CurrentPage()
|
||||
if p != nil {
|
||||
p.Item.(*logView).Clear()
|
||||
}
|
||||
}
|
||||
|
||||
func (v *logsView) deleteAllPages() {
|
||||
for i, c := range v.containers {
|
||||
v.RemovePage(c)
|
||||
|
|
@ -100,18 +117,23 @@ func (v *logsView) load(i int) {
|
|||
return
|
||||
}
|
||||
v.SwitchToPage(v.containers[i])
|
||||
v.buffer.clear()
|
||||
if err := v.doLoad(v.pv.selectedItem, v.containers[i]); err != nil {
|
||||
v.pv.app.flash(flashErr, err.Error())
|
||||
v.buffer.add("😂 Doh! No logs are available at this time. Check again later on...")
|
||||
l := v.CurrentPage().Item.(*logView)
|
||||
l.log(v.buffer)
|
||||
return
|
||||
}
|
||||
v.pv.app.SetFocus(v)
|
||||
}
|
||||
|
||||
func (v *logsView) killLogIfAny() {
|
||||
if v.cancelFunc != nil {
|
||||
v.cancelFunc()
|
||||
v.cancelFunc = nil
|
||||
if v.cancelFunc == nil {
|
||||
return
|
||||
}
|
||||
v.cancelFunc()
|
||||
v.cancelFunc = nil
|
||||
}
|
||||
|
||||
func (v *logsView) doLoad(path, co string) error {
|
||||
|
|
@ -119,14 +141,41 @@ func (v *logsView) doLoad(path, co string) error {
|
|||
|
||||
c := make(chan string)
|
||||
go func() {
|
||||
l := v.CurrentPage().Item.(*logView)
|
||||
for s := range c {
|
||||
fmt.Fprintln(l, s)
|
||||
l, count, first := v.CurrentPage().Item.(*logView), 0, true
|
||||
for {
|
||||
select {
|
||||
case line, ok := <-c:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
v.buffer.add(line)
|
||||
case <-time.After(refreshRate):
|
||||
if count == maxCleanse {
|
||||
log.Debug("Cleansing logs")
|
||||
v.buffer.cleanse()
|
||||
count = 0
|
||||
}
|
||||
count++
|
||||
if v.buffer.length() == 0 {
|
||||
l.Clear()
|
||||
continue
|
||||
}
|
||||
l.log(v.buffer)
|
||||
if first {
|
||||
l.ScrollToEnd()
|
||||
first = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
ns, po := namespaced(path)
|
||||
cancelFn, err := v.pv.list.Resource().(resource.Tailable).Logs(c, ns, po, co)
|
||||
res, ok := v.pv.list.Resource().(resource.Tailable)
|
||||
if !ok {
|
||||
return fmt.Errorf("Resource %T is not tailable", v.pv.list.Resource)
|
||||
}
|
||||
maxBuff := k9sCfg.K9s.LogBufferSize
|
||||
cancelFn, err := res.Logs(c, ns, po, co, int64(maxBuff))
|
||||
if err != nil {
|
||||
cancelFn()
|
||||
return err
|
||||
|
|
@ -135,3 +184,47 @@ func (v *logsView) doLoad(path, co string) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Actions...
|
||||
|
||||
func (v *logsView) back(*tcell.EventKey) {
|
||||
v.stop()
|
||||
v.pv.switchPage(v.pv.list.GetName())
|
||||
}
|
||||
|
||||
func (v *logsView) top(*tcell.EventKey) {
|
||||
if p := v.CurrentPage(); p != nil {
|
||||
v.pv.app.flash(flashInfo, "Top logs...")
|
||||
p.Item.(*logView).ScrollToBeginning()
|
||||
}
|
||||
}
|
||||
|
||||
func (v *logsView) bottom(*tcell.EventKey) {
|
||||
if p := v.CurrentPage(); p != nil {
|
||||
v.pv.app.flash(flashInfo, "Bottom logs...")
|
||||
p.Item.(*logView).ScrollToEnd()
|
||||
}
|
||||
}
|
||||
|
||||
func (v *logsView) pageUp(*tcell.EventKey) {
|
||||
if p := v.CurrentPage(); p != nil {
|
||||
v.pv.app.flash(flashInfo, "Page Up logs...")
|
||||
p.Item.(*logView).PageUp()
|
||||
}
|
||||
}
|
||||
|
||||
func (v *logsView) pageDown(*tcell.EventKey) {
|
||||
if p := v.CurrentPage(); p != nil {
|
||||
v.pv.app.flash(flashInfo, "Page Down logs...")
|
||||
p.Item.(*logView).PageDown()
|
||||
}
|
||||
}
|
||||
|
||||
func (v *logsView) clearLogs(*tcell.EventKey) {
|
||||
if p := v.CurrentPage(); p != nil {
|
||||
v.pv.app.flash(flashInfo, "Clearing logs...")
|
||||
v.buffer.clear()
|
||||
p.Item.(*logView).Clear()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
package views
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/derailed/k9s/resource"
|
||||
"github.com/gdamore/tcell"
|
||||
)
|
||||
|
||||
type namespaceView struct {
|
||||
*resourceView
|
||||
}
|
||||
|
||||
func newNamespaceView(t string, app *appView, list resource.List, c colorerFn) resourceViewer {
|
||||
v := namespaceView{
|
||||
resourceView: newResourceView(t, app, list, c).(*resourceView),
|
||||
}
|
||||
v.extraActionsFn = v.extraActions
|
||||
v.decorateDataFn = v.decorate
|
||||
v.switchPage("ns")
|
||||
return &v
|
||||
}
|
||||
|
||||
func (v *namespaceView) useNamespace(*tcell.EventKey) {
|
||||
if !v.rowSelected() {
|
||||
return
|
||||
}
|
||||
|
||||
k9sCfg.K9s.Namespace.Active = v.selectedItem
|
||||
k9sCfg.addFavNS(v.selectedItem)
|
||||
k9sCfg.validateAndSave()
|
||||
v.app.flash(flashInfo, fmt.Sprintf("Setting namespace `%s as your default namespace", v.selectedItem))
|
||||
}
|
||||
|
||||
func (v *namespaceView) extraActions(aa keyActions) {
|
||||
aa[tcell.KeyCtrlS] = keyAction{description: "Switch", action: v.useNamespace}
|
||||
}
|
||||
|
||||
func (v *namespaceView) decorate(data resource.TableData) resource.TableData {
|
||||
if _, ok := data.Rows[resource.AllNamespaces]; !ok {
|
||||
data.Rows[resource.AllNamespace] = &resource.RowEvent{
|
||||
Action: resource.Unchanged,
|
||||
Fields: resource.Row{resource.AllNamespace, "Active", "0"},
|
||||
Deltas: resource.Row{"", "", ""},
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range data.Rows {
|
||||
if k9sCfg.K9s.Namespace.Active == k {
|
||||
v.Fields[0] = v.Fields[0] + "*"
|
||||
v.Action = resource.Unchanged
|
||||
}
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
32
views/pod.go
32
views/pod.go
|
|
@ -14,23 +14,15 @@ func newPodView(t string, app *appView, list resource.List, c colorerFn) resourc
|
|||
v := podView{newResourceView(t, app, list, c).(*resourceView)}
|
||||
v.extraActionsFn = v.extraActions
|
||||
|
||||
logs := newLogsView(&v)
|
||||
{
|
||||
logs.setActions(keyActions{
|
||||
tcell.KeyCtrlB: {description: "Back", action: v.stopLogs},
|
||||
tcell.KeyCtrlK: {description: "Clear", action: v.clearLogs},
|
||||
})
|
||||
v.AddPage("logs", logs, true, false)
|
||||
}
|
||||
v.AddPage("logs", newLogsView(&v), true, false)
|
||||
|
||||
picker := newSelectList()
|
||||
{
|
||||
picker.SetSelectedFunc(func(i int, t, d string, r rune) {
|
||||
log.Println("Selected", i, t, d, r)
|
||||
v.sshInto(v.selectedItem, t)
|
||||
})
|
||||
picker.setActions(keyActions{
|
||||
tcell.KeyCtrlB: {description: "Back", action: v.back},
|
||||
tcell.KeyEscape: {description: "Back", action: v.back},
|
||||
})
|
||||
v.AddPage("choose", picker, true, false)
|
||||
}
|
||||
|
|
@ -41,10 +33,6 @@ func newPodView(t string, app *appView, list resource.List, c colorerFn) resourc
|
|||
|
||||
// Handlers...
|
||||
|
||||
func (v *podView) back(*tcell.EventKey) {
|
||||
v.switchPage(v.list.GetName())
|
||||
}
|
||||
|
||||
func (v *podView) logs(*tcell.EventKey) {
|
||||
if !v.rowSelected() {
|
||||
return
|
||||
|
|
@ -65,7 +53,7 @@ func (v *podView) logs(*tcell.EventKey) {
|
|||
l.init()
|
||||
}
|
||||
|
||||
func (v *podView) ssh(*tcell.EventKey) {
|
||||
func (v *podView) shell(*tcell.EventKey) {
|
||||
if !v.rowSelected() {
|
||||
return
|
||||
}
|
||||
|
|
@ -92,7 +80,7 @@ func (v *podView) showPicker(cc []string) {
|
|||
}
|
||||
|
||||
func (v *podView) sshInto(path, co string) {
|
||||
v.app.flash(flashInfo, "SSH into pod", path)
|
||||
v.app.flash(flashInfo, "Shell into pod", path)
|
||||
ns, po := namespaced(path)
|
||||
if len(co) == 0 {
|
||||
run(v.app, "exec", "-it", "-n", ns, po, "--", "sh")
|
||||
|
|
@ -101,19 +89,9 @@ func (v *podView) sshInto(path, co string) {
|
|||
}
|
||||
}
|
||||
|
||||
func (v *podView) clearLogs(*tcell.EventKey) {
|
||||
v.app.flash(flashInfo, "Clearing logs...")
|
||||
v.GetPrimitive("logs").(*logsView).clearLogs()
|
||||
}
|
||||
|
||||
func (v *podView) stopLogs(*tcell.EventKey) {
|
||||
v.GetPrimitive("logs").(*logsView).stop()
|
||||
v.switchPage(v.list.GetName())
|
||||
}
|
||||
|
||||
func (v *podView) extraActions(aa keyActions) {
|
||||
aa[tcell.KeyCtrlL] = newKeyHandler("Logs", v.logs)
|
||||
aa[tcell.KeyCtrlS] = newKeyHandler("SSH", v.ssh)
|
||||
aa[tcell.KeyCtrlS] = newKeyHandler("Shell", v.shell)
|
||||
}
|
||||
|
||||
func fetchContainers(l resource.List, po string) ([]string, error) {
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ var cmdMap = map[string]resCmd{
|
|||
"ns": {
|
||||
title: "Namespaces",
|
||||
api: "core",
|
||||
viewFn: newResourceView,
|
||||
viewFn: newNamespaceView,
|
||||
listFn: resource.NewNamespaceList,
|
||||
colorerFn: nsColorer,
|
||||
},
|
||||
|
|
@ -241,24 +241,5 @@ func getCRDS() map[string]k8s.ApiGroup {
|
|||
m[s] = grp
|
||||
}
|
||||
}
|
||||
|
||||
// m["cm"] = k8s.ApiGroup{
|
||||
// Version: "v1",
|
||||
// Group: "core",
|
||||
// Kind: "ConfigMap",
|
||||
// Singular: "configmap",
|
||||
// Plural: "configmaps",
|
||||
// Aliases: []string{"cm"},
|
||||
// }
|
||||
|
||||
// m["svc"] = k8s.ApiGroup{
|
||||
// Version: "v1",
|
||||
// Group: "core",
|
||||
// Kind: "Service",
|
||||
// Singular: "service",
|
||||
// Plural: "services",
|
||||
// Aliases: []string{"svc"},
|
||||
// }
|
||||
|
||||
return m
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,12 @@ import (
|
|||
"github.com/gdamore/tcell"
|
||||
"github.com/k8sland/tview"
|
||||
log "github.com/sirupsen/logrus"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
const noSelection = ""
|
||||
const (
|
||||
noSelection = ""
|
||||
maxNamespaces = 5
|
||||
)
|
||||
|
||||
type (
|
||||
details interface {
|
||||
|
|
@ -39,6 +41,7 @@ type (
|
|||
suspendUpdate bool
|
||||
list resource.List
|
||||
extraActionsFn func(keyActions)
|
||||
decorateDataFn func(resource.TableData) resource.TableData
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -63,12 +66,12 @@ func newResourceView(title string, app *appView, list resource.List, c colorerFn
|
|||
xray = newYamlView(app)
|
||||
}
|
||||
xray.setActions(keyActions{
|
||||
tcell.KeyCtrlB: {description: "Back", action: v.back},
|
||||
tcell.KeyEscape: {description: "Back", action: v.back},
|
||||
})
|
||||
|
||||
details := newDetailsView()
|
||||
details.setActions(keyActions{
|
||||
tcell.KeyCtrlB: {description: "Back", action: v.back},
|
||||
tcell.KeyEscape: {description: "Back", action: v.back},
|
||||
})
|
||||
|
||||
v.AddPage("details", details, true, false)
|
||||
|
|
@ -89,13 +92,13 @@ func (v *resourceView) init(ctx context.Context, ns string) {
|
|||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
log.Printf("%s watcher canceled!", v.title)
|
||||
log.Debugf("%s watcher canceled!", v.title)
|
||||
return
|
||||
case <-time.After(time.Duration(initTick) * time.Second):
|
||||
if !v.isSuspended() {
|
||||
v.refresh()
|
||||
}
|
||||
initTick = float64(v.app.refreshRate)
|
||||
initTick = float64(k9sCfg.K9s.RefreshRate)
|
||||
}
|
||||
}
|
||||
}(ctx)
|
||||
|
|
@ -187,14 +190,18 @@ func (v *resourceView) edit(*tcell.EventKey) {
|
|||
}
|
||||
|
||||
func (v *resourceView) switchNamespace(evt *tcell.EventKey) {
|
||||
i, _ := strconv.Atoi(string(evt.Rune()))
|
||||
ns := v.namespaces[i]
|
||||
v.doSwitchNamespace(ns)
|
||||
}
|
||||
|
||||
func (v *resourceView) doSwitchNamespace(ns string) {
|
||||
v.suspend()
|
||||
{
|
||||
i, _ := strconv.Atoi(string(evt.Rune()))
|
||||
ns := v.namespaces[i]
|
||||
v.selectedNS = ns
|
||||
if ns == noSelection {
|
||||
ns = "all"
|
||||
ns = resource.AllNamespace
|
||||
}
|
||||
v.selectedNS = ns
|
||||
v.app.flash(flashInfo, fmt.Sprintf("Viewing `%s namespace...", ns))
|
||||
v.list.SetNamespace(v.selectedNS)
|
||||
v.refresh()
|
||||
|
|
@ -204,6 +211,8 @@ func (v *resourceView) switchNamespace(evt *tcell.EventKey) {
|
|||
v.getTV().resetTitle()
|
||||
v.getTV().Select(0, 0)
|
||||
v.app.resetCmd()
|
||||
k9sCfg.K9s.Namespace.Active = v.selectedNS
|
||||
k9sCfg.validateAndSave()
|
||||
}
|
||||
|
||||
// Utils...
|
||||
|
|
@ -224,13 +233,19 @@ func (v *resourceView) refresh() {
|
|||
if _, ok := v.CurrentPage().Item.(*tableView); !ok {
|
||||
return
|
||||
}
|
||||
|
||||
v.list.SetNamespace(v.selectedNS)
|
||||
if v.list.Namespaced() {
|
||||
v.list.SetNamespace(v.selectedNS)
|
||||
}
|
||||
if err := v.list.Reconcile(); err != nil {
|
||||
v.app.flash(flashErr, err.Error())
|
||||
}
|
||||
|
||||
v.refreshActions()
|
||||
v.getTV().update(v.list.Data())
|
||||
data := v.list.Data()
|
||||
if v.decorateDataFn != nil {
|
||||
data = v.decorateDataFn(data)
|
||||
}
|
||||
v.getTV().update(data)
|
||||
v.app.infoView.refresh()
|
||||
v.app.Draw()
|
||||
}
|
||||
|
|
@ -299,19 +314,33 @@ func (v *resourceView) refreshActions() {
|
|||
return
|
||||
}
|
||||
|
||||
if v.list.Namespaced() && !v.list.AllNamespaces() && !inNSList(nn, v.list.GetNamespace()) {
|
||||
v.list.SetNamespace(resource.DefaultNamespace)
|
||||
}
|
||||
|
||||
aa := keyActions{}
|
||||
if v.list.Access(resource.NamespaceAccess) {
|
||||
v.namespaces = make(map[int]string, len(nn))
|
||||
v.namespaces = make(map[int]string, maxNamespaces)
|
||||
var i int
|
||||
aa[tcell.Key(numKeys[i])] = newKeyHandler("all", v.switchNamespace)
|
||||
v.namespaces[i] = resource.AllNamespaces
|
||||
i++
|
||||
for _, n := range k9sCfg.K9s.Namespace.Favorites {
|
||||
if n == resource.AllNamespace {
|
||||
aa[tcell.Key(numKeys[i])] = newKeyHandler(resource.AllNamespace, v.switchNamespace)
|
||||
v.namespaces[i] = resource.AllNamespaces
|
||||
i++
|
||||
continue
|
||||
}
|
||||
|
||||
for _, n := range nn {
|
||||
nsp := n.(v1.Namespace)
|
||||
v.namespaces[i] = nsp.Name
|
||||
aa[tcell.Key(numKeys[i])] = newKeyHandler(nsp.Name, v.switchNamespace)
|
||||
i++
|
||||
if inNSList(nn, n) {
|
||||
aa[tcell.Key(numKeys[i])] = newKeyHandler(n, v.switchNamespace)
|
||||
v.namespaces[i] = n
|
||||
i++
|
||||
} else {
|
||||
k9sCfg.rmFavNS(n)
|
||||
k9sCfg.validateAndSave()
|
||||
}
|
||||
if i > maxNamespaces {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -333,6 +362,8 @@ func (v *resourceView) refreshActions() {
|
|||
}
|
||||
|
||||
t := v.getTV()
|
||||
t.setActions(aa)
|
||||
v.app.setHints(t.hints())
|
||||
{
|
||||
t.setActions(aa)
|
||||
v.app.setHints(t.hints())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,13 @@ package views
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/derailed/k9s/resource"
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/k8sland/tview"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -16,13 +19,16 @@ const (
|
|||
type (
|
||||
tableView struct {
|
||||
*tview.Table
|
||||
baseTitle string
|
||||
currentNS string
|
||||
actions keyActions
|
||||
colorer colorerFn
|
||||
cmdBuff string
|
||||
sortFn resource.SortFn
|
||||
parent *resourceView
|
||||
baseTitle string
|
||||
currentNS string
|
||||
actions keyActions
|
||||
colorer colorerFn
|
||||
sortFn resource.SortFn
|
||||
parent *resourceView
|
||||
cmdBuffer []rune
|
||||
data resource.TableData
|
||||
searchMode bool
|
||||
filtered bool
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -44,25 +50,62 @@ func (v *tableView) setDeleted() {
|
|||
for x := 0; x < cols; x++ {
|
||||
v.GetCell(r, x).SetAttributes(tcell.AttrDim)
|
||||
}
|
||||
v.Select(0, 0)
|
||||
}
|
||||
|
||||
func (v *tableView) keyboard(evt *tcell.EventKey) *tcell.EventKey {
|
||||
key := evt.Key()
|
||||
if evt.Key() == tcell.KeyRune {
|
||||
if a, ok := v.actions[tcell.Key(evt.Rune())]; ok {
|
||||
a.action(evt)
|
||||
evt = nil
|
||||
if evt.Rune() == '/' {
|
||||
v.searchMode = true
|
||||
v.cmdBuffer = []rune{}
|
||||
} else {
|
||||
if v.searchMode {
|
||||
v.cmdBuffer = append([]rune(v.cmdBuffer), evt.Rune())
|
||||
}
|
||||
}
|
||||
return evt
|
||||
key = tcell.Key(evt.Rune())
|
||||
}
|
||||
|
||||
if a, ok := v.actions[evt.Key()]; ok {
|
||||
if a, ok := v.actions[key]; ok {
|
||||
a.action(evt)
|
||||
return nil
|
||||
}
|
||||
|
||||
switch evt.Key() {
|
||||
case tcell.KeyEnter:
|
||||
v.filtered = true
|
||||
v.filter()
|
||||
v.searchMode = false
|
||||
evt = nil
|
||||
case tcell.KeyEsc:
|
||||
v.filtered, v.searchMode = false, false
|
||||
v.cmdBuffer = []rune{}
|
||||
evt = nil
|
||||
}
|
||||
return evt
|
||||
}
|
||||
|
||||
func (v *tableView) filter() {
|
||||
v.filterData(string(v.cmdBuffer))
|
||||
}
|
||||
|
||||
func (v *tableView) filterData(filter string) {
|
||||
filtered := resource.TableData{
|
||||
Header: v.data.Header,
|
||||
Rows: resource.RowEvents{},
|
||||
Namespace: v.data.Namespace,
|
||||
}
|
||||
|
||||
rx := regexp.MustCompile(filter)
|
||||
for k, row := range v.data.Rows {
|
||||
f := strings.Join(row.Fields, " ")
|
||||
if rx.MatchString(f) {
|
||||
filtered.Rows[k] = row
|
||||
}
|
||||
}
|
||||
v.doUpdate(filtered)
|
||||
}
|
||||
|
||||
// SetColorer sets up table row color management.
|
||||
func (v *tableView) SetColorer(f colorerFn) {
|
||||
v.colorer = f
|
||||
|
|
@ -89,20 +132,36 @@ func (v *tableView) hints() hints {
|
|||
}
|
||||
|
||||
func (v *tableView) resetTitle() {
|
||||
var title string
|
||||
|
||||
switch v.currentNS {
|
||||
case resource.NotNamespaced:
|
||||
v.SetTitle(fmt.Sprintf(titleFmt, v.baseTitle, v.GetRowCount()-1))
|
||||
title = fmt.Sprintf(titleFmt, v.baseTitle, v.GetRowCount()-1)
|
||||
default:
|
||||
ns := v.currentNS
|
||||
if v.currentNS == resource.AllNamespaces {
|
||||
ns = "all"
|
||||
ns = resource.AllNamespace
|
||||
}
|
||||
v.SetTitle(fmt.Sprintf(nsTitleFmt, v.baseTitle, ns, v.GetRowCount()-1))
|
||||
title = fmt.Sprintf(nsTitleFmt, v.baseTitle, ns, v.GetRowCount()-1)
|
||||
}
|
||||
|
||||
if v.filtered {
|
||||
title += fmt.Sprintf("<[green::b]/%s[aqua::]> ", string(v.cmdBuffer))
|
||||
}
|
||||
v.SetTitle(title)
|
||||
}
|
||||
|
||||
// Update table content
|
||||
func (v *tableView) update(data resource.TableData) {
|
||||
v.data = data
|
||||
if v.filtered {
|
||||
v.filter()
|
||||
} else {
|
||||
v.doUpdate(data)
|
||||
}
|
||||
}
|
||||
|
||||
func (v *tableView) doUpdate(data resource.TableData) {
|
||||
v.Clear()
|
||||
v.currentNS = data.Namespace
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,107 @@
|
|||
package views
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const newLogColor = "greenyellow"
|
||||
|
||||
type (
|
||||
logBuffer struct {
|
||||
capacity int
|
||||
decorate bool
|
||||
modified bool
|
||||
head *logEntry
|
||||
current *logEntry
|
||||
rx *regexp.Regexp
|
||||
}
|
||||
|
||||
logEntry struct {
|
||||
line string
|
||||
next *logEntry
|
||||
}
|
||||
)
|
||||
|
||||
func newLogBuffer(c int, f bool) *logBuffer {
|
||||
return &logBuffer{capacity: c, decorate: f, rx: regexp.MustCompile(`\[\w*\:\:\]`)}
|
||||
}
|
||||
|
||||
func (b *logBuffer) clear() {
|
||||
b.head, b.current = nil, nil
|
||||
}
|
||||
|
||||
func (b *logBuffer) add(line string) {
|
||||
b.modified = true
|
||||
if b.decorate {
|
||||
line = b.decorateLine(line)
|
||||
}
|
||||
n := logEntry{line: line}
|
||||
if b.head == nil {
|
||||
b.head = &n
|
||||
b.current = b.head
|
||||
return
|
||||
}
|
||||
|
||||
if b.full() {
|
||||
b.head = b.head.next
|
||||
}
|
||||
b.current.next = &n
|
||||
b.current = &n
|
||||
}
|
||||
|
||||
func (b *logBuffer) full() bool {
|
||||
return b.length() == b.capacity
|
||||
}
|
||||
|
||||
func (b *logBuffer) length() int {
|
||||
c, count := b.head, 0
|
||||
for c != nil {
|
||||
c = c.next
|
||||
count++
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
func (*logBuffer) decorateLine(l string) string {
|
||||
return "[" + newLogColor + "::]" + l + "[::]"
|
||||
}
|
||||
|
||||
func (b *logBuffer) trimLine(l string) string {
|
||||
return b.rx.ReplaceAllString(l, "")
|
||||
}
|
||||
|
||||
func (b *logBuffer) cleanse() {
|
||||
if !b.modified {
|
||||
return
|
||||
}
|
||||
c := b.head
|
||||
for c != nil {
|
||||
c.line = b.trimLine(c.line)
|
||||
c = c.next
|
||||
}
|
||||
b.modified = true
|
||||
}
|
||||
|
||||
func (b *logBuffer) String() string {
|
||||
return strings.Join(b.lines(), "\n")
|
||||
}
|
||||
|
||||
func (b *logBuffer) lines() []string {
|
||||
out := make([]string, b.length())
|
||||
c := b.head
|
||||
for i := 0; c != nil; i++ {
|
||||
out[i] = c.line
|
||||
c = c.next
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (b *logBuffer) dump() {
|
||||
c := b.head
|
||||
for c != nil {
|
||||
fmt.Println(c.line)
|
||||
c = c.next
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package views
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestLogBufferAdd(t *testing.T) {
|
||||
uu := []struct {
|
||||
lines []string
|
||||
expected []string
|
||||
}{
|
||||
{[]string{}, []string{}},
|
||||
{[]string{"l1"}, []string{"l1"}},
|
||||
{[]string{"l1", "l2"}, []string{"l1", "l2"}},
|
||||
{[]string{"l1", "l2", "l3"}, []string{"l2", "l3"}},
|
||||
{[]string{"l1", "l2", "l3", "l4"}, []string{"l3", "l4"}},
|
||||
}
|
||||
|
||||
for _, u := range uu {
|
||||
b := newLogBuffer(2, false)
|
||||
for _, l := range u.lines {
|
||||
b.add(l)
|
||||
}
|
||||
|
||||
assert.Equal(t, len(u.expected), b.length())
|
||||
assert.Equal(t, u.expected, b.lines())
|
||||
}
|
||||
}
|
||||
|
||||
func TestLogBufferCleanse(t *testing.T) {
|
||||
b := newLogBuffer(2, true)
|
||||
ll := []string{"l1", "l2"}
|
||||
ee := []string{b.decorateLine("l1"), b.decorateLine("l2")}
|
||||
for _, l := range ll {
|
||||
b.add(l)
|
||||
}
|
||||
assert.Equal(t, ee, b.lines())
|
||||
b.cleanse()
|
||||
assert.Equal(t, ll, b.lines())
|
||||
}
|
||||
|
||||
func TestLogBufferDecorate(t *testing.T) {
|
||||
l := "hello k9s"
|
||||
var b *logBuffer
|
||||
assert.Equal(t, "["+newLogColor+"::]"+l+"[::]", b.decorateLine(l))
|
||||
}
|
||||
|
||||
func TestLogBufferTrimLine(t *testing.T) {
|
||||
l := "hello k9s"
|
||||
dl := "[" + newLogColor + "::]" + l + "[::]"
|
||||
b := newLogBuffer(1, true)
|
||||
assert.Equal(t, l, b.trimLine(dl))
|
||||
}
|
||||
Loading…
Reference in New Issue