Compare commits
1 commit
5ced6729ce
...
8bd1adca82
Author | SHA1 | Date | |
---|---|---|---|
8bd1adca82 |
2 changed files with 12 additions and 3 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"git.sr.ht/~blallo/papero/cli"
|
||||
|
@ -56,8 +57,8 @@ func (pm PutMessageCmd) Func(args []string) error {
|
|||
var opts imaputils.PutMessageOpts
|
||||
var err error
|
||||
var bodyReader io.Reader
|
||||
var messageTime cli.AbsTimeFlag
|
||||
var flagSeen, flagAnswered, flagFlagged, flagDeleted, flagDraft bool
|
||||
var messageTime = cli.NewAbsTimeFlag()
|
||||
if Session.Info.Opts.Debug {
|
||||
Log.Debug("enter add message")
|
||||
}
|
||||
|
@ -104,6 +105,8 @@ func (pm PutMessageCmd) Func(args []string) error {
|
|||
|
||||
opts.Time = *messageTime.Time
|
||||
|
||||
Log.Debugf("Opts: %+v\n", opts)
|
||||
|
||||
imaputils.PutMessage(Session.Config, &opts)
|
||||
|
||||
return nil
|
||||
|
@ -116,14 +119,14 @@ func (pm PutMessageCmd) Help(w io.Writer, set *flag.FlagSet) {
|
|||
}
|
||||
|
||||
func readIntoBuffer(r io.Reader) (*bytes.Buffer, error) {
|
||||
var b []byte
|
||||
var empty bytes.Buffer
|
||||
|
||||
_, err := io.ReadFull(r, b)
|
||||
b, err := ioutil.ReadAll(r)
|
||||
if err != nil {
|
||||
return &empty, err
|
||||
}
|
||||
|
||||
Log.Debugf("content %+v\n", b)
|
||||
buff := bytes.NewBuffer(b)
|
||||
return buff, nil
|
||||
}
|
||||
|
|
|
@ -90,6 +90,12 @@ type AbsTimeFlag struct {
|
|||
*time.Time
|
||||
}
|
||||
|
||||
func NewAbsTimeFlag() AbsTimeFlag {
|
||||
return AbsTimeFlag{
|
||||
Time: &time.Time{},
|
||||
}
|
||||
}
|
||||
|
||||
func (t AbsTimeFlag) String() string {
|
||||
return fmt.Sprint(t.Time)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue