2023-02-16 14:57:39 +03:00
|
|
|
package paths
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"flag"
|
|
|
|
"bufio"
|
|
|
|
"os"
|
2023-02-16 19:28:05 +03:00
|
|
|
"github.com/surdeus/goblin/src/pathx"
|
2023-02-16 14:57:39 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
)
|
|
|
|
|
|
|
|
func handlePath(p string) {
|
2023-02-16 19:28:05 +03:00
|
|
|
pth := pathx.From(p)
|
|
|
|
fmt.Println(pth.Real())
|
2023-02-16 14:57:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func Run(args []string) {
|
|
|
|
arg0 := args[0]
|
|
|
|
args = args[1:]
|
|
|
|
flags := flag.NewFlagSet(arg0, flag.ExitOnError)
|
|
|
|
flags.Parse(args)
|
|
|
|
args = flags.Args()
|
|
|
|
|
|
|
|
for _, p := range args {
|
|
|
|
handlePath(p)
|
|
|
|
}
|
|
|
|
|
|
|
|
rd := bufio.NewScanner(os.Stdin)
|
|
|
|
for rd.Scan() {
|
|
|
|
handlePath(rd.Text())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|