Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7dac79233 | ||
|
|
8c45d4a7df | ||
|
|
1e3f24b4d5 |
@@ -22,7 +22,11 @@ func main() {
|
||||
}
|
||||
|
||||
func _main() error {
|
||||
filepath := flag.String("f", "-", "path to yaml file")
|
||||
defaultFilepath, ok := os.LookupEnv("PTTODO_FILE")
|
||||
if !ok {
|
||||
defaultFilepath = "-"
|
||||
}
|
||||
filepath := flag.String("f", defaultFilepath, "($PTTODO_FILE) path to yaml file")
|
||||
e := flag.Bool("e", false, "edit file")
|
||||
flag.Parse()
|
||||
if *e {
|
||||
@@ -40,6 +44,7 @@ func edit(filepath string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := os.Stat(filepath); err == nil {
|
||||
g, err := os.Open(filepath)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -48,6 +53,7 @@ func edit(filepath string) error {
|
||||
return err
|
||||
}
|
||||
g.Close()
|
||||
}
|
||||
f.Close()
|
||||
tempFile = f.Name()
|
||||
return nil
|
||||
@@ -1,4 +1,4 @@
|
||||
module pttodo
|
||||
module pttodo-cli
|
||||
|
||||
go 1.17
|
||||
|
||||
Reference in New Issue
Block a user