29 lines
493 B
Go
29 lines
493 B
Go
|
package pp
|
||
|
|
||
|
import (
|
||
|
"vultras.su/core/cli/mtool"
|
||
|
"fmt"
|
||
|
"os"
|
||
|
"log"
|
||
|
"path/filepath"
|
||
|
)
|
||
|
|
||
|
var Tool = mtool.T("pp").Func(func(flags *mtool.Flags){
|
||
|
pp := NewPp()
|
||
|
filePaths := flags.Parse()
|
||
|
for _, filePath := range filePaths {
|
||
|
pth := filepath.FromSlash(filePath)
|
||
|
bts, err := os.ReadFile(pth)
|
||
|
if err != nil {
|
||
|
log.Println("read error:", err)
|
||
|
continue
|
||
|
}
|
||
|
str, err := pp.Process(string(bts))
|
||
|
if err != nil {
|
||
|
log.Println("pp error:", err)
|
||
|
continue
|
||
|
}
|
||
|
fmt.Print(str)
|
||
|
}
|
||
|
})
|