diff --git a/README.md b/README.md index 810e530..cf8bf98 100644 --- a/README.md +++ b/README.md @@ -66,21 +66,22 @@ Link together Mavlink endpoints. Flags: --help Show context-sensitive help (also try --help-long and --help-man). + --version print mavp2p version -q, --quiet suppress info messages during - execution. - --print-errors print parse errors on screen. + execution + --print-errors print parse errors on screen --hb-disable disable heartbeats --hb-version=1 set mavlink version of heartbeats - --hb-systemid=125 set system id of heartbeats.it is + --hb-systemid=125 set system id of heartbeats. it is recommended to set a different system - id for each router in the network. + id for each router in the network --hb-period=5 set period of heartbeats --apreqstream-disable do not request streams to Ardupilot devices, that need an explicit request in order to emit telemetry streams. this task is usually delegated to the router, to avoid conflicts in case - multiple ground stations are active. + multiple ground stations are active --apreqstream-frequency=4 set the stream frequency to request Args: diff --git a/main.go b/main.go index 6c54e50..b0309a0 100644 --- a/main.go +++ b/main.go @@ -87,12 +87,14 @@ func main() { kingpin.CommandLine.Help = "mavp2p " + Version + "\n\n" + "Link together Mavlink endpoints." - quiet := kingpin.Flag("quiet", "suppress info messages during execution.").Short('q').Bool() - printErrors := kingpin.Flag("print-errors", "print parse errors on screen.").Bool() + version := kingpin.Flag("version", "print mavp2p version").Bool() + + quiet := kingpin.Flag("quiet", "suppress info messages during execution").Short('q').Bool() + printErrors := kingpin.Flag("print-errors", "print parse errors on screen").Bool() hbDisable := kingpin.Flag("hb-disable", "disable heartbeats").Bool() hbVersion := kingpin.Flag("hb-version", "set mavlink version of heartbeats").Default("1").Enum("1", "2") - hbSystemId := kingpin.Flag("hb-systemid", "set system id of heartbeats."+ + hbSystemId := kingpin.Flag("hb-systemid", "set system id of heartbeats"+ "it is recommended to set a different system id for each router in the network.").Default("125").Int() hbPeriod := kingpin.Flag("hb-period", "set period of heartbeats").Default("5").Int() @@ -109,14 +111,20 @@ func main() { } endpoints := kingpin.Arg("endpoints", desc).Strings() + kingpin.Parse() + + // print version + if *version == true { + fmt.Println("mavp2p " + Version) + os.Exit(0) + } + // print usage if no args are provided if len(os.Args) <= 1 { kingpin.Usage() os.Exit(1) } - kingpin.Parse() - if len(*endpoints) < 2 { initError("at least 2 endpoints are required") }