Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/10sr/tbar
Visualize values with ascii characters in terminal
https://github.com/10sr/tbar
Last synced: about 2 months ago
JSON representation
Visualize values with ascii characters in terminal
- Host: GitHub
- URL: https://github.com/10sr/tbar
- Owner: 10sr
- License: unlicense
- Created: 2013-10-15T07:00:08.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-02-08T05:39:31.000Z (almost 11 years ago)
- Last Synced: 2024-10-07T10:27:20.173Z (3 months ago)
- Language: Python
- Homepage:
- Size: 203 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
tbar
====Visualize values with ascii characters in terminal.
Synopsis and Options
--------usage: tbar [-h] [-r REGEXP] [-c COMMENT] [-s SEP] [-f FIELD] [-m MAX]
[-l LENGTH] [-v]
[filename]
Visualize values with ascii characters in terminal
positional arguments:
filename filename for input. If omitted read from stdin
optional arguments:
-h, --help show this help message and exit
-r REGEXP, --regexp REGEXP
regular expression to extract key and value. When this
option is given, -s and -f options are ignored
-c COMMENT_START, --comment COMMENT_START
string that leading commnent strings, defaults to "#"
-s SEP, --sep SEP separator of field
-f NUM,NUM, --field NUM,NUM
numbers of field to use as key and value, default to
1,2
-m MAX, --max MAX value for max
-l LENGTH, --length LENGTH
length of bars, defaults to 50
-v, --vertical print bars verticallyUsage Example
-------------When the content of `sample/a.txt` is like:
# sample data
a 80
bcdef 40
ghi 20
jk 90then the command
./bin/tbar sample/a.txt
will print bars as:
90.0
a|******************************************** |
bcdef|********************** |
ghi|*********** |
jk|**************************************************|When specifying the option `--vertical`, tbar prints bars vertically:
$ ./bin/tbar --vertical --length 10 sample/a.txt
90.0----
*
*
* *
* *
* *
* *
** *
** *
****
****
----
abgj
chk
di
e
fSpecifying Field to Show
------------------------When extracting data from input line, there are two ways: cut-like options and
regular expression.
Using cut-like options is an easy way. For example, when input lines are# sample data
a 80
bcdef 40
ghi 20
jk 90then you can use the first field as key (name) and the second as value by
specifying the options like--sep " " --field 1,2
(Actually this options are set by default so you do not need these options for
this simple case)
If you want to deal with rather complicated input, you can use regular
expression with symbolic groups instead. For example, specifying--regexp '^(?P[^ ]*) *(?P[^ ]*)'
means the same thing as previous example by cut-like options.
License
-------This software is released under Public Domain. For more information, see
'LICENSE'.