Skip to content

Commit

Permalink
Merge pull request #3 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 0.0.3
  • Loading branch information
andyone authored May 29, 2020
2 parents dbf5a49 + 5e34c87 commit 8c0f559
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 36 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
language: go

go:
- 1.10.x
- 1.11.x
- 1.12.x
- 1.13.x
- 1.14.x
- tip

os:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ git-config: ## Configure git redirects for stable import path services
git config --global http.https://pkg.re.followRedirects true

deps: git-config ## Download dependencies
go get -d -v pkg.re/essentialkaos/ek.v11
go get -d -v pkg.re/essentialkaos/ek.v12

fmt: ## Format source code with gofmt
find . -name "*.go" -exec gofmt -s -w {} \;
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

### Usage demo

[![demo](https://gh.kaos.st/fz-001.gif)](#usage-demo)
[![demo](https://gh.kaos.st/fz-003.gif)](#usage-demo)

### Installation

Expand All @@ -25,7 +25,7 @@ Before the initial install, allow git to use redirects for [pkg.re](https://gith
git config --global http.https://pkg.re.followRedirects true
```

To build the `fz` from scratch, make sure you have a working Go 1.10+ workspace (_[instructions](https://golang.org/doc/install)_), then:
To build the `fz` from scratch, make sure you have a working Go 1.13+ workspace (_[instructions](https://golang.org/doc/install)_), then:

```
go get github.com/essentialkaos/fz
Expand Down
45 changes: 15 additions & 30 deletions fz.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ import (
"strings"
"time"

"pkg.re/essentialkaos/ek.v11/fmtc"
"pkg.re/essentialkaos/ek.v11/fmtutil"
"pkg.re/essentialkaos/ek.v11/options"
"pkg.re/essentialkaos/ek.v11/signal"
"pkg.re/essentialkaos/ek.v11/strutil"
"pkg.re/essentialkaos/ek.v11/timeutil"
"pkg.re/essentialkaos/ek.v11/usage"
"pkg.re/essentialkaos/ek.v11/usage/completion/bash"
"pkg.re/essentialkaos/ek.v11/usage/completion/fish"
"pkg.re/essentialkaos/ek.v11/usage/completion/zsh"
"pkg.re/essentialkaos/ek.v11/usage/update"
"pkg.re/essentialkaos/ek.v12/fmtc"
"pkg.re/essentialkaos/ek.v12/fmtutil"
"pkg.re/essentialkaos/ek.v12/options"
"pkg.re/essentialkaos/ek.v12/signal"
"pkg.re/essentialkaos/ek.v12/strutil"
"pkg.re/essentialkaos/ek.v12/timeutil"
"pkg.re/essentialkaos/ek.v12/usage"
"pkg.re/essentialkaos/ek.v12/usage/completion/bash"
"pkg.re/essentialkaos/ek.v12/usage/completion/fish"
"pkg.re/essentialkaos/ek.v12/usage/completion/zsh"
"pkg.re/essentialkaos/ek.v12/usage/update"
)

// ////////////////////////////////////////////////////////////////////////////////// //

// App info
const (
APP = "fz"
VER = "0.0.2"
VER = "0.0.3"
DESC = "Tool for formatting go-fuzz output"
)

Expand Down Expand Up @@ -200,13 +200,11 @@ func renderInfo(cur Info) {
crashersTag = "{r}"
}

execsArrow := getDynamicsArrow(cur.ExecsPerSec, prevInfo.ExecsPerSec)

fmtc.TPrintf(
"{s}%s{!} {s-}[%s]{!} {*}Workers:{!} "+workersTag+"%d{!} {s}β”‚{!} {*}Corpus:{!} "+corpusTag+"%s{!} {s-}(%s){!} {s}β”‚{!} {*}Crashers:{!} "+crashersTag+"%d {s}β”‚{!} {*}Restarts:{!} %s {s}β”‚{!} {*}Cover:{!} "+coverTag+"%s{!} {s}β”‚{!} {*}Execs:{!} {s}%s{!}%s{s}/s{!} {s-}(%s){!}",
"{s}%s{!} {s-}[%s]{!} {*}Workers:{!} "+workersTag+"%d{!} {s-}β€’{!} {*}Corpus:{!} "+corpusTag+"%s{!} {s-}(%s){!} {s-}β€’{!} {*}Crashers:{!} "+crashersTag+"%d {s-}β€’{!} {*}Restarts:{!} %s {s-}β€’{!} {*}Cover:{!} "+coverTag+"%s{!} {s-}β€’{!} {*}Execs:{!} %s{s}/s{!} {s-}(%s){!}",
cur.DateTime, formatDuration(cur.Uptime), cur.Workers, fmtutil.PrettyNum(cur.Corpus),
formatDuration(cur.CorpusDur), cur.Crashers, cur.Restarts, fmtutil.PrettyNum(cur.Cover),
execsArrow, fmtutil.PrettyNum(cur.ExecsPerSec), fmtutil.PrettyNum(cur.Execs),
fmtutil.PrettyNum(cur.ExecsPerSec), fmtutil.PrettyNum(cur.Execs),
)
}

Expand All @@ -223,7 +221,7 @@ func printResults() {
execs := fmtutil.PrettyNum(prevInfo.Execs)

fmtc.TPrintf(
"{*}Duration:{!} %s {s}β”‚{!} {*}Execs:{!} %s {s}β”‚{!} {*}Corpus:{!} %s {s}β”‚{!} {*}Crashers:{!} %s {s}β”‚{!} {*}Cover:{!} %s\n",
"{*}Duration:{!} %s {s-}β€’{!} {*}Execs:{!} %s {s-}β€’{!} {*}Corpus:{!} %s {s-}β€’{!} {*}Crashers:{!} %s {s-}β€’{!} {*}Cover:{!} %s\n",
duration, execs, corpus, crashers, cover,
)
}
Expand All @@ -241,19 +239,6 @@ func getIndicatorTag(v1, v2 int) string {
}
}

// getIndicatorTag returns arrow symbol based on difference between
// current and previous values
func getDynamicsArrow(v1, v2 int) string {
switch {
case v1 > v2:
return "↑"
case v1 < v2:
return "↓"
default:
return ""
}
}

// formatDuration formats duration
func formatDuration(d int64) string {
var min, sec int64
Expand Down

0 comments on commit 8c0f559

Please sign in to comment.