termdash/linestyle/linestyle.go

52 lines
1.4 KiB
Go
Raw Normal View History

2019-02-24 15:01:31 +08:00
// Copyright 2019 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package linestyle defines various line styles.
package linestyle
2019-02-25 06:53:27 +08:00
// LineStyle defines the supported line styles.
type LineStyle int
// String implements fmt.Stringer()
func (ls LineStyle) String() string {
if n, ok := lineStyleNames[ls]; ok {
return n
}
return "LineStyleUnknown"
}
// lineStyleNames maps LineStyle values to human readable names.
var lineStyleNames = map[LineStyle]string{
2019-02-24 14:51:50 +08:00
None: "LineStyleNone",
Light: "LineStyleLight",
Double: "LineStyleDouble",
Round: "LineStyleRound",
}
// Supported line styles.
// See https://en.wikipedia.org/wiki/Box-drawing_character.
const (
2019-02-24 14:51:50 +08:00
// None indicates that no line should be present.
None LineStyle = iota
2019-02-24 14:51:50 +08:00
// Light is line style using the '─' characters.
Light
// Double is line style using the '═' characters.
Double
// Round is line style using the rounded corners '╭' characters.
Round
)