X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcmd%2Fnncp-caller%2Fmain.go;h=7297350d41b746efa23eb5380726eac15c19e2a9;hb=1d2ce674b042d07fd9b37a46578c8b62bb0345b7;hp=e97ea8555f4e6d91dda10d5500f529cde4c59fdc;hpb=46a831419b4b0ba458283ba705abfcc100f41242;p=nncp.git diff --git a/src/cmd/nncp-caller/main.go b/src/cmd/nncp-caller/main.go index e97ea85..7297350 100644 --- a/src/cmd/nncp-caller/main.go +++ b/src/cmd/nncp-caller/main.go @@ -19,11 +19,11 @@ along with this program. If not, see . 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))