You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mir/pathflag.go

22 lines
282 B
Go

3 years ago
package main
import (
"fmt"
"os"
)
type pathArg struct {
path string
}
func (p *pathArg) Set(s string) error {
_, err := os.Stat(s)
if err != nil {
return fmt.Errorf("bad path arg: %w", err)
}
p.path = s
return nil
}
func (p pathArg) String() string { return p.path }