Skip to content

Commit

Permalink
remove some invalid codes. update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Oct 11, 2018
1 parent 2b33408 commit 90a8a7a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 94 deletions.
29 changes: 10 additions & 19 deletions README.md
Expand Up @@ -25,25 +25,7 @@ Basic color preview:
- Extra style: `Info` `Note` `Light` `Error` `Danger` `Notice` `Success` `Comment` `Primary` `Warning` `Question` `Secondary`
- Compatible with Windows system environment

## Install

- use dep

```bash
dep ensure -add gopkg.in/gookit/color.v1 // is recommended
// OR
dep ensure -add github.com/gookit/color
```

- go get

```bash
go get gopkg.in/gookit/color.v1 // is recommended
// OR
go get -u github.com/gookit/color
```

## Godoc
## GoDoc

- [godoc for gopkg](https://godoc.org/gopkg.in/gookit/color.v1)
- [godoc for github](https://godoc.org/github.com/gookit/color)
Expand Down Expand Up @@ -150,8 +132,17 @@ color.Yellow.Println("yellow message")
- `color.Secondary`

```go
// print message
color.Info.Print("Info message")
color.Success.Print("Success message")

// prompt message
color.Info.Prompt("prompt style message")
color.Warn.Prompt("prompt style message")

// tips message
color.Info.Tips("tips style message")
color.Warn.Tips("tips style message")
```

> run demo: `go run ./_examples/theme_style.go`
Expand Down
22 changes: 2 additions & 20 deletions README_cn.md
@@ -1,4 +1,4 @@
# color
# CLI Color

[![GoDoc](https://godoc.org/github.com/gookit/color?status.svg)](https://godoc.org/github.com/gookit/color)
[![Build Status](https://travis-ci.org/gookit/color.svg?branch=master)](https://travis-ci.org/gookit/color)
Expand All @@ -25,25 +25,7 @@ golang下的命令行色彩使用库, 拥有丰富的色彩渲染输出,通用
- 扩展风格: `Info` `Note` `Light` `Error` `Danger` `Notice` `Success` `Comment` `Primary` `Warning` `Question` `Secondary`
- 兼容Windows系统环境

## 获取安装

- 使用 dep 包管理

```bash
dep ensure -add gopkg.in/gookit/color.v1 // 推荐
// OR
dep ensure -add github.com/gookit/color
```

- 使用 go get

```bash
go get gopkg.in/gookit/color.v1 // 推荐
// OR
go get -u github.com/gookit/color
```

## Godoc
## GoDoc

- [godoc for gopkg](https://godoc.org/gopkg.in/gookit/color.v1)
- [godoc for github](https://godoc.org/github.com/gookit/color)
Expand Down
55 changes: 0 additions & 55 deletions tag.go
Expand Up @@ -358,58 +358,3 @@ func (tg Tag) Sprintf(format string, a ...interface{}) string {
name := string(tg)
return RenderString(GetTagCode(name), fmt.Sprintf(format, a...))
}

// Tips value is a defined style name, will add color for all text.
// Deprecated: please use `Color.Info.Prompt()` instead of
type Tips string

// Print messages
func (t Tips) Print(args ...interface{}) {
name := string(t)
msg := strings.ToUpper(name) + ": " + fmt.Sprint(args...)
if isLikeInCmd {
GetStyle(name).Println(msg)
} else {
fmt.Println(RenderString(GetTagCode(name), msg))
}
}

// Printf format and print messages
func (t Tips) Printf(format string, a ...interface{}) {
name := string(t)
msg := strings.ToUpper(name) + ": " + fmt.Sprintf(format, a...)
if isLikeInCmd {
GetStyle(name).Println(msg)
} else {
fmt.Println(RenderString(GetTagCode(name), msg))
}
}

// LiteTips will only add color for tag name
// value is a defined style name
// Deprecated: please use `Color.Info.Tips()` instead of
type LiteTips string

// Print tips message with new line
func (t LiteTips) Print(a ...interface{}) {
tag := string(t)
title := strings.ToUpper(tag) + ":"
if isLikeInCmd {
GetStyle(tag).Print(title)
fmt.Println(a...)
} else {
fmt.Println(RenderString(GetTagCode(tag), title), fmt.Sprint(a...))
}
}

// Printf format and print messages
func (t LiteTips) Printf(format string, a ...interface{}) {
tag := string(t)
title := strings.ToUpper(tag) + ":"
if isLikeInCmd {
GetStyle(tag).Print(title)
fmt.Println(fmt.Sprintf(format, a...))
} else {
fmt.Println(RenderString(GetTagCode(tag), title), fmt.Sprintf(format, a...))
}
}

0 comments on commit 90a8a7a

Please sign in to comment.