]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cmd/nncp-caller/main.go
Operations progress
[nncp.git] / src / cmd / nncp-caller / main.go
index e97ea8555f4e6d91dda10d5500f529cde4c59fdc..7297350d41b746efa23eb5380726eac15c19e2a9 100644 (file)
@@ -19,11 +19,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 package main
 
 import (
+       "errors"
        "flag"
        "fmt"
        "log"
        "os"
-       "strconv"
        "sync"
        "time"
 
@@ -44,6 +44,8 @@ func main() {
                spoolPath = flag.String("spool", "", "Override path to spool")
                logPath   = flag.String("log", "", "Override path to logfile")
                quiet     = flag.Bool("quiet", false, "Print only errors")
+               showPrgrs = flag.Bool("progress", false, "Force progress showing")
+               omitPrgrs = flag.Bool("noprogress", false, "Omit progress showing")
                debug     = flag.Bool("debug", false, "Print debug messages")
                version   = flag.Bool("version", false, "Print version information")
                warranty  = flag.Bool("warranty", false, "Print warranty information")
@@ -59,7 +61,15 @@ func main() {
                return
        }
 
-       ctx, err := nncp.CtxFromCmdline(*cfgPath, *spoolPath, *logPath, *quiet, *debug)
+       ctx, err := nncp.CtxFromCmdline(
+               *cfgPath,
+               *spoolPath,
+               *logPath,
+               *quiet,
+               *showPrgrs,
+               *omitPrgrs,
+               *debug,
+       )
        if err != nil {
                log.Fatalln("Error during initialization:", err)
        }
@@ -105,13 +115,13 @@ func main() {
                                } else {
                                        addrs = append(addrs, *call.Addr)
                                }
-                               sds := nncp.SDS{"node": node.Id, "callindex": strconv.Itoa(i)}
+                               sds := nncp.SDS{"node": node.Id, "callindex": i}
                                for {
                                        n := time.Now()
                                        t := call.Cron.Next(n)
                                        ctx.LogD("caller", sds, t.String())
                                        if t.IsZero() {
-                                               ctx.LogE("caller", sds, "got zero time")
+                                               ctx.LogE("caller", sds, errors.New("got zero time"), "")
                                                return
                                        }
                                        time.Sleep(t.Sub(n))