Skip to content

Commit

Permalink
made head and tail mutually exclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
joeygibson committed Jan 23, 2021
1 parent 7a55640 commit 117ab37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A tool to count the rows, and take rows from [Vertica native binary files](http
## Usage

```bash
Usage: verticat [-cfHv] [-h value] [-o value] [-t value] [parameters ...]
Usage: verticat [-cfHv] [-h value] [-o value] [-t value] <file>
-c, --count count rows
-f, --force force overwrite of output file
-h, --head=value take the first n rows
Expand Down
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func main() {

getopt.SetParameters("<file>")
getopt.Parse()

args := getopt.Args()

if *helpFlag {
Expand All @@ -46,7 +47,13 @@ func main() {
}

if len(args) == 0 {
_, _ = fmt.Fprintln(os.Stderr, "no file given")
_, _ = fmt.Fprintf(os.Stderr, "Error: no file given\n\n")
getopt.PrintUsage(os.Stderr)
os.Exit(1)
}

if *headRows > 0 && *tailRows > 0 {
fmt.Fprintf(os.Stderr, "Error: --head and --tail are mutually exclusive\n\n")
getopt.PrintUsage(os.Stderr)
os.Exit(1)
}
Expand Down

0 comments on commit 117ab37

Please sign in to comment.