mirror of
https://github.com/darmiel/yaxc.git
synced 2025-09-04 05:25:53 +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 @@
|
||||||
|
[](https://github.com/darmiel/yaxc/actions/workflows/deploy_hub.yml) |
|
||||||
|
[](https://github.com/darmiel/yaxc/actions/workflows/test.yml) |
|
||||||
|
[](https://deepsource.io/gh/darmiel/yaxc/?ref=repository-badge)
|
||||||
|
|
||||||
<!-- Logo -->
|
<!-- Logo -->
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="./assets/YAxC-Filled@128px.png" alt="yaxc">
|
<img src="./assets/YAxC-Filled@128px.png" alt="yaxc">
|
||||||
|
|
|
@ -36,7 +36,7 @@ var pasteCmd = &cobra.Command{
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
// Read pipe
|
// Read pipe
|
||||||
pipe, err := common.ReadPipe()
|
pipe, err := common.ReadPipe()
|
||||||
if err == common.NotPiped {
|
if err == common.ErrNotPiped {
|
||||||
log.Fatalln("The command is intended to work with pipes.")
|
log.Fatalln("The command is intended to work with pipes.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var NotPiped = errors.New("not piped")
|
var ErrNotPiped = errors.New("not piped")
|
||||||
|
|
||||||
func ReadPipe() (res string, err error) {
|
func ReadPipe() (res string, err error) {
|
||||||
var info os.FileInfo
|
var info os.FileInfo
|
||||||
|
@ -16,7 +16,7 @@ func ReadPipe() (res string, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if info.Mode()&os.ModeCharDevice != 0 || info.Size() <= 0 {
|
if info.Mode()&os.ModeCharDevice != 0 || info.Size() <= 0 {
|
||||||
err = NotPiped
|
err = ErrNotPiped
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
|
|
Loading…
Add table
Reference in a new issue