From: Sergey Matveev Date: Fri, 4 Mar 2022 10:43:40 +0000 (+0300) Subject: nncp-rm -pkt takes list of packets from stdin X-Git-Tag: v8.7.0^2~1 X-Git-Url: http://www.git.cypherpunks.ru/?p=nncp.git;a=commitdiff_plain;h=ba16c17a029e3a1b2c836915b2473edcee259277 nncp-rm -pkt takes list of packets from stdin --- diff --git a/doc/cmd/nncp-rm.texi b/doc/cmd/nncp-rm.texi index 4c74f0a..0267673 100644 --- a/doc/cmd/nncp-rm.texi +++ b/doc/cmd/nncp-rm.texi @@ -11,7 +11,12 @@ $ nncp-rm [options] @{-all|-node NODE@} -nock $ nncp-rm [options] @{-all|-node NODE@} -hdr $ nncp-rm [options] @{-all|-node NODE@} -area $ nncp-rm [options] @{-all|-node NODE@} [-rx] [-tx] -$ nncp-rm [options] @{-all|-node NODE@} -pkt PKT +$ nncp-rm [options] @{-all|-node NODE@} -pkt < 0 { + if _, exists := pkts[filepath.Base(info.Name())]; exists { + ctx.LogI("rm", nncp.LEs{{K: "File", V: path}}, logMsg) + if *dryRun { + return nil + } + return os.Remove(path) } - return os.Remove(path) } if !*doSeen && !*doNoCK && !*doHdr && !*doPart && (*doRx || *doTx) && @@ -234,12 +252,12 @@ func main() { return nil }) } - if *pktRaw != "" || *doRx || *doNoCK || *doPart { + if len(pkts) > 0 || *doRx || *doNoCK || *doPart { if err = remove(nncp.TRx); err != nil { log.Fatalln("Can not remove:", err) } } - if *pktRaw != "" || *doTx || *doHdr { + if len(pkts) > 0 || *doTx || *doHdr { if err = remove(nncp.TTx); err != nil { log.Fatalln("Can not remove:", err) } @@ -315,9 +333,12 @@ func main() { return nil } if now.Sub(info.ModTime()) < oldBoundary { - ctx.LogD("rm-skip", nncp.LEs{{K: "File", V: path}}, func(les nncp.LEs) string { - return fmt.Sprintf("File %s: too fresh, skipping", path) - }) + ctx.LogD( + "rm-skip", nncp.LEs{{K: "File", V: path}}, + func(les nncp.LEs) string { + return fmt.Sprintf("File %s: too fresh, skipping", path) + }, + ) return nil } ctx.LogI(