From e0c1667fcce7b9b8fb474add248d9fa823159fb9 Mon Sep 17 00:00:00 2001 From: Saxon1 Date: Thu, 19 Apr 2018 19:07:25 +0930 Subject: [PATCH] making cli more robust --- RevidCLI.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/RevidCLI.go b/RevidCLI.go index 62c7beed..663d616c 100644 --- a/RevidCLI.go +++ b/RevidCLI.go @@ -137,11 +137,17 @@ func main() { config.Input = revid.Rtp case "File": config.Input = revid.File + case "": + default: + fmt.Println("Bad input argument!") } switch *configFlags[inputCodecPtr] { case "H264Codec": config.InputCodec = revid.H264Codec + case "": + default: + fmt.Println("Bad input codec argument!") } switch *configFlags[outputPtr] { @@ -151,6 +157,9 @@ func main() { config.Output = revid.Http case "Rtmp": config.Output = revid.Rtmp + case "": + default: + fmt.Println("Bad output argument!") } switch *configFlags[rtmpMethodPtr] { @@ -158,6 +167,9 @@ func main() { config.RtmpMethod = revid.Ffmpeg case "LibRtmp": config.RtmpMethod = revid.LibRtmp + case "": + default: + fmt.Println("Bad rtmp method argument!") } switch *configFlags[packetizationPtr] { @@ -167,6 +179,9 @@ func main() { config.Packetization = revid.Rtp case "Flv": config.Packetization = revid.Flv + case "": + default: + fmt.Println("Bad packetization argument!") } switch *configFlags[quantizationModePtr] { @@ -174,6 +189,9 @@ func main() { config.QuantizationMode = revid.QuantizationOn case "QuantizationOff": config.QuantizationMode = revid.QuantizationOff + case "": + default: + fmt.Println("Bad quantization mode argument!") } switch *configFlags[verbosityPtr] { @@ -181,6 +199,9 @@ func main() { config.Verbosity = revid.No case "Yes": config.Verbosity = revid.Yes + case "": + default: + fmt.Println("Bad verbosity argument!") } config.FramesPerClip = *configFlags[framesPerClipPtr]