Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fixes #252]: Add --no-bars flag #288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ Valid keys are: `mountpoint`, `size`, `used`, `avail`, `usage`, `inodes`,
List inode information instead of block usage:

duf --inodes

Do not display the bar in USE%:

duf --no-bars

If duf doesn't detect your terminal's colors correctly, you can set a theme:

Expand Down
3 changes: 3 additions & 0 deletions duf.1
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ output fields: mountpoint, size, used, avail, usage, inodes, inodes_used, inodes
\fB-sort\fP
sort output by: mountpoint, size, used, avail, usage, inodes, inodes_used, inodes_avail, inodes_usage, type, filesystem
.TP
\fB-no-bars\fP
do not show bars in USE%
.TP
\fB-style\fP
style: unicode, ascii
.TP
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var (
usageThreshold = flag.String("usage-threshold", "0.5,0.9", "specifies the coloring threshold (yellow, red) of the usage bars as a floating point number from 0 to 1")

inodes = flag.Bool("inodes", false, "list inode information instead of block usage")
noBars = flag.Bool("no-bars", false, "do not show bars in USE%")
jsonOutput = flag.Bool("json", false, "output all devices in JSON format")
warns = flag.Bool("warnings", false, "output all warnings to STDERR")
version = flag.Bool("version", false, "display version")
Expand Down
2 changes: 1 addition & 1 deletion table.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func barTransformer(val interface{}) string {
usage := val.(float64)
s := termenv.String()
if usage > 0 {
if barWidth() > 0 {
if barWidth() > 0 && !*noBars {
bw := barWidth() - 2
s = termenv.String(fmt.Sprintf("[%s%s] %5.1f%%",
strings.Repeat("#", int(usage*float64(bw))),
Expand Down