Skip to content

dysk output produces colour reset (ESC[0m) even when color=no #105

@ezramorris

Description

@ezramorris

dysk output produces colour reset sequence (ESC[0m) at the end of the output even when color=no

Examples (sed used here to replace escape key with ESC):

$ dysk | sed 's/\x1B/ESC/g'; echo
┌──────────┬─────┬─────┬────┬─────────┬────┬────┬────────────────────────┐
│filesystem│type │disk │used│   use   │free│size│mount point             │
├──────────┼─────┼─────┼────┼─────────┼────┼────┼────────────────────────┤
│/dev/sdb5 │ext4 │ SSD │170G│37% █▉   │236G│406G│/home                   │
│/dev/sdb6 │ext4 │ SSD │7.8G│ 9% ▌    │ 46G│ 53G│/mnt/lfs                │
│/dev/sda5 │ext4 │ SSD │ 26G│78% ███▉ │5.4G│ 32G│/                       │
│/dev/sdc1 │exfat│remov│ 12G│80% ████ │3.1G│ 15G│/run/media/ezra/Ventoy  │
│/dev/sdd1 │exfat│remov│9.7G│63% ███▏ │5.7G│ 15G│/run/media/ezra/Ventoy32│
└──────────┴─────┴─────┴────┴─────────┴────┴────┴────────────────────────┘
ESC[0m
$ dysk --color=no | sed 's/\x1B/ESC/g'; echo
┌──────────┬─────┬─────┬────┬─────────┬────┬────┬────────────────────────┐
│filesystem│type │disk │used│   use   │free│size│mount point             │
├──────────┼─────┼─────┼────┼─────────┼────┼────┼────────────────────────┤
│/dev/sdb5 │ext4 │ SSD │170G│37% █▉   │236G│406G│/home                   │
│/dev/sdb6 │ext4 │ SSD │7.8G│ 9% ▌    │ 46G│ 53G│/mnt/lfs                │
│/dev/sda5 │ext4 │ SSD │ 26G│78% ███▉ │5.4G│ 32G│/                       │
│/dev/sdc1 │exfat│remov│ 12G│80% ████ │3.1G│ 15G│/run/media/ezra/Ventoy  │
│/dev/sdd1 │exfat│remov│9.7G│63% ███▏ │5.7G│ 15G│/run/media/ezra/Ventoy32│
└──────────┴─────┴─────┴────┴─────────┴────┴────┴────────────────────────┘
ESC[0m

Note; this is not normally visible as the output is not commonly piped to another process, and isn't visible in the terminal. My use case was using watch. watch dysk produces the following:

Every 2.0s: dysk                                                                    (hostname): 12:33:08
                                                                                                 in 0.007s (0)
┌──────────┬─────┬─────┬────┬─────────┬────┬────┬────────────────────────┐
│filesystem│type │disk │used│   use   │free│size│mount point             │
├──────────┼─────┼─────┼────┼─────────┼────┼────┼────────────────────────┤
│/dev/sdb5 │ext4 │ SSD │170G│37% █▉   │236G│406G│/home                   │
│/dev/sdb6 │ext4 │ SSD │7.8G│ 9% ▌    │ 46G│ 53G│/mnt/lfs                │
│/dev/sda5 │ext4 │ SSD │ 26G│78% ███▉ │5.4G│ 32G│/                       │
│/dev/sdc1 │exfat│remov│ 12G│80% ████ │3.1G│ 15G│/run/media/ezra/Ventoy  │
│/dev/sdd1 │exfat│remov│9.7G│63% ███▏ │5.7G│ 15G│/run/media/ezra/Ventoy32│
└──────────┴─────┴─────┴────┴─────────┴────┴────┴────────────────────────┘
[0m

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions