getconfig in pttodo-cli

master
Bel LaPointe 2022-03-23 07:27:49 -06:00
parent 20770ff5e6
commit 0bd6347a93
2 changed files with 0 additions and 42 deletions

2
go.mod
View File

@ -5,7 +5,6 @@ go 1.17
require ( require (
github.com/robfig/cron/v3 v3.0.1 github.com/robfig/cron/v3 v3.0.1
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
local/sandbox/contact/contact v0.0.0-00010101000000-000000000000
) )
require ( require (
@ -15,4 +14,3 @@ require (
golang.org/x/text v0.3.7 // indirect golang.org/x/text v0.3.7 // indirect
) )
replace local/sandbox/contact/contact => ../sandbox/contact/contact

View File

@ -1,40 +0,0 @@
package pttodo
/*
action is something like 'send an email on trigger' but is not impl or use
*/
import (
"errors"
"local/sandbox/contact/contact"
"net/url"
"regexp"
)
type Action string
var (
actionEmailPattern = regexp.MustCompile(`[^@]+@.*[^\.]+\.[a-z]+`)
)
func (action Action) String() string {
return string(action)
}
func (action Action) CB() (func() error, error) {
u, _ := url.Parse(action.String())
switch u.Scheme {
case "email":
return action.email, nil
}
if actionEmailPattern.MatchString(action.String()) {
return action.email, nil
}
return nil, errors.New("unrecognized action")
}
func (action Action) email() error {
em := contact.NewEmailer()
_ = em
return errors.New("not impl")
}