mirror of
https://github.com/darmiel/yaxc.git
synced 2024-12-26 01:01:24 +08:00
More Code-Style
This commit is contained in:
parent
c1ffda6138
commit
4b7a7e55d7
3 changed files with 7 additions and 3 deletions
|
@ -1,3 +1,7 @@
|
|||
[![Deploy to docker hub (v-tag)](https://github.com/darmiel/yaxc/actions/workflows/deploy_hub.yml/badge.svg)](https://github.com/darmiel/yaxc/actions/workflows/deploy_hub.yml) |
|
||||
[![.github/workflows/test.yml](https://github.com/darmiel/yaxc/actions/workflows/test.yml/badge.svg)](https://github.com/darmiel/yaxc/actions/workflows/test.yml) |
|
||||
[![DeepSource](https://deepsource.io/gh/darmiel/yaxc.svg/?label=active+issues&show_trend=true)](https://deepsource.io/gh/darmiel/yaxc/?ref=repository-badge)
|
||||
|
||||
<!-- Logo -->
|
||||
<p align="center">
|
||||
<img src="./assets/YAxC-Filled@128px.png" alt="yaxc">
|
||||
|
|
|
@ -36,7 +36,7 @@ var pasteCmd = &cobra.Command{
|
|||
Run: func(cmd *cobra.Command, args []string) {
|
||||
// Read pipe
|
||||
pipe, err := common.ReadPipe()
|
||||
if err == common.NotPiped {
|
||||
if err == common.ErrNotPiped {
|
||||
log.Fatalln("The command is intended to work with pipes.")
|
||||
return
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
var NotPiped = errors.New("not piped")
|
||||
var ErrNotPiped = errors.New("not piped")
|
||||
|
||||
func ReadPipe() (res string, err error) {
|
||||
var info os.FileInfo
|
||||
|
@ -16,7 +16,7 @@ func ReadPipe() (res string, err error) {
|
|||
return
|
||||
}
|
||||
if info.Mode()&os.ModeCharDevice != 0 || info.Size() <= 0 {
|
||||
err = NotPiped
|
||||
err = ErrNotPiped
|
||||
return
|
||||
}
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
|
|
Loading…
Reference in a new issue