Skip to content

Commit

Permalink
Report incorrect or missing commands
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeppe-pivotal committed Nov 25, 2020
1 parent 7248b3c commit 9b889d9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"fmt"
"os"
"bufio"
"io"
Expand All @@ -12,6 +13,11 @@ import (
func main() {
flag.Parse()

if len(flag.Args()) < 2 {
fmt.Println("Too few args specified. Supported commands are 'times', 'unique' and 'hang'.")
os.Exit(1)
}

var p core.Progress
switch flag.Arg(0) {
case "times":
Expand All @@ -20,10 +26,14 @@ func main() {
p = core.NewProgressUniques()
case "hang":
p = core.NewProgressHangs()
default:
fmt.Printf("Invalid command: '%s'. Supported commands are 'times', 'unique' and 'hang'.\n", flag.Arg(0))
os.Exit(1)
}

var line string
for i := 1; i < flag.NArg(); i++ {
fmt.Printf("-------- %s --------\n", flag.Arg(i))
progressFile, err := os.Open(flag.Arg(i))
if err != nil {
panic(err)
Expand Down

0 comments on commit 9b889d9

Please sign in to comment.