// Package nodecli implements evobgp-node subcommands (pull/verify/apply bundle). package nodecli import ( "fmt" "os" ) // Run executes a subcommand from args (without program name). Returns exit code. func Run(args []string) int { if len(args) < 1 { Usage(os.Stderr) return 2 } switch args[0] { case "pull-bundle": return CmdPullBundle(args[1:]) case "verify-bundle": return CmdVerifyBundle(args[1:]) case "apply-bundle": return CmdApplyBundle(args[1:]) default: Usage(os.Stderr) return 2 } } // Usage prints CLI help to w. func Usage(w interface{ Write([]byte) (int, error) }) { _, _ = fmt.Fprintf(w, `Usage: evobgp-node pull-bundle -base-url URL -token TOKEN -speaker-id ID [-revision-id ID] [-o path] evobgp-node verify-bundle -f bundle.tar.gz (-pubkey-base64 B64 | -pubkey-hex HEX) evobgp-node apply-bundle -f bundle.tar.gz -extract-dir DIR (-pubkey-base64 B64 | -pubkey-hex HEX) [-bird PATH] [-birdc PATH] [-socket PATH] [-timeout DURATION] apply-bundle verifies, extracts, runs bird -p on main bird.conf, then birdc configure. `) }