Skip to content

Commit

Permalink
Merge pull request #16 from miclle/master
Browse files Browse the repository at this point in the history
Only one of 'file path' and 'unix character device' flag can be selected
  • Loading branch information
momaek authored Jun 30, 2024
2 parents 92b8cf7 + e19752a commit 4d0751f
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bufio"
"flag"
"fmt"
"io/ioutil"
"log"
"os"

Expand Down Expand Up @@ -34,13 +33,13 @@ func main() {

if len(file) > 0 {
align.Init(file)
}

stat, _ := os.Stdin.Stat()
if (stat.Mode() & os.ModeCharDevice) == 0 {
reader := bufio.NewReader(os.Stdin)
align.Init(reader)
writeToConsole = true
} else {
stat, _ := os.Stdin.Stat()
if (stat.Mode() & os.ModeCharDevice) == 0 {
reader := bufio.NewReader(os.Stdin)
align.Init(reader)
writeToConsole = true
}
}

b, err := align.Do()
Expand All @@ -53,5 +52,5 @@ func main() {
return
}

ioutil.WriteFile(file, b, 0)
os.WriteFile(file, b, 0)
}

0 comments on commit 4d0751f

Please sign in to comment.