bartender
Customizable bars for v term apps.
Getting started
Install via v
cli
-
From source
v install --git https://github.com/tobealive/bartender
import bartender
-
As vpm module
v install tobealive.bartender
import tobealive.bartender
Usage examples
-
Simple bars
// Defaul bar mut b := Bar{} for _ in 0 .. b.iters { b.progress() } // Customized bar mut b2 := Bar{ width: 60 runes: BarRunes{ progress: `#` indicator: `❯` remaining: `-` } pre: '|' post: Affix{ pending: '| Loading...' finished: '| Done!' } } for _ in 0 .. b2.iters { b2.progress() }
-
Smooth bar themes
mut b := SmoothBar{ theme: Theme.pull // Default = Theme.push } for _ in 0 .. b.iters { b.progress() } b2 = SmoothBar{ theme: ThemeVariant{.pull, .drain} } for _ in 0 .. b2.iters { b2.progress() } // Customized smooth bar mut b3 := SmoothBar{ theme: Theme.split width: 80 pre: '│' post: fn (b SmoothBar) (string, string) { return '│ Saving... ${b.pct()}% ${term.blue(b.eta(20))}', '│ Saved!' } } b3.colorize(.cyan) for _ in 0 .. b3.iters { b3.progress() }
-
Bar Reader for
io
operations.// 500 MB of sample content. content := '1234567890'.repeat(50 * 1024 * 1024) mut r := bar_reader(Bar{}, content.bytes()) mut f := os.create('testfile')! io.cp(mut r, mut f)!
Run examples
Extended and executable examples can be found in the sample files.
v run examples/<file>.v
Showcase
Disclaimer
Until a stable version 1.0 is available, new features will be introduced, existing ones may change,
or breaking changes may occur in minor(0.<minor>.*
) versions.
Outlook
Below are some of the things to look forward to.
- Reader Interface
- Multiline (Smooth Bar Split Themes are not supported yet)
- Time Remaining
- Dynamic adjustment on term resize for all variants (basic width detection works)
- Extend visuals & customizability
Anowledgements
- Waqar144/progressbar inspired the start of project.
- console-rs/indicatif serves as inspiration for further development.
- ArtemkaKun/v-project-basement served as a base for CI scripts and issue templates