Need help with fish-spark?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

jorgebucaran
232 Stars 7 Forks MIT License 44 Commits 0 Opened issues

Description

▁▂▄▆▇█▇▆▄▂▁

Services available

!
?

Need anything else?

Contributors list

# 3,572
Shell
fish-sh...
vdom
elm
43 commits
# 11,236
GitHub
usersty...
github-...
Vue.js
1 commit

spark.fish

Sparklines for Fish.

Unofficial port of spark.sh with

--min
,
--max
flags and improved performance.

Installation

Install with Fisher:

fisher install jorgebucaran/spark.fish

Quickstart

You want to visualize a range of numbers right in your terminal.

$ spark 1 2 4 8
▁▂▄█

And here is a sequence of random numbers.

$ seq 64 | sort --random-sort | spark
▅▄▂▇▂▅▆▄▃█▂▅▄▁▆▆▃█▄▁▇▅▂▃▇▃▃▄▇▄▅▆▇▂▅▁▇▁▄▂▆▅▃█▇▆▆▅▆▃▄▄▇▃▂▇█▅▃█▁▂▂▆

You can set the

--min=
or
--max=
values for your sparkline too.
$ seq 10 20 | spark
▁▂▂▃▄▄▅▆▇▇█
$ seq 10 20 | spark --min=0
▄▅▅▆▆▆▇▇▇██
$ seq 10 20 | spark --min=0 --max=30
▃▄▄▄▄▄▅▅▅▅▆

Wicked Cool Usage

Most of the examples in this section are derived from the original Wicked Cool Usage wiki, ported to Fish.

Line lengths.

$ awk \$0=length (functions --details spark) | spark
▃▆▃▃▃▄▃▂▄▄▄▅▂▄▅▂▆▁▅▂▅▅▃▂▂▆▃█▂▁▁▁

Number of commits in a repo, by author.

$ git shortlog --summary | string match --regex "\d+" | spark
█▁▁▁▃▁▁▄▁▁▁

Total run time of processes.

$ ps -A | string replace --filter --regex -- ".*(\d+):(\d+).*" "\$1 * 3600 + \$2 * 60" | bc | spark
▇▁▂▁▆▁▂▂▁▃▁▃▁▁▁▆▁▁▁▂▁▃▂▁▁▃▁▁▁▁▁▂▁▁▂▁▁▁▁▁▆▂▃▂▁▂▃▁▆▁▁▁▂▁▁▁▁▃▂▂▁▇▁▁▁▁▆

LOC added per commit over the last week.

$ git diff @~7 --numstat | string replace --regex -- "(^\d+).*" "\$1" | spark
▁▁▁▁▁▁▁▁▂▁▁▁▁▁▁▂▂▃█▄▁▁

A moving wave through the terminal.

for i in (seq 100)
   for j in (seq (math $COLUMNS - 1))
      math "ceil(6 * cos(($i + $j) * pi / 5))"
   end | spark | read sparks
   echo -n $sparks\r && sleep .1
end
▆▄▂▁▂▄▆▇█▇▆▄▂▁▂▄▆▇█▇▆▄▂▁▂▄▆▇█▇▆▄▂▁▂▄▆▇█▇▆▄▂▁▂▄▆▇█▇▆▄▂▁▂▄▆▇█

Performance

Spark is faster than

spark.sh
, reading and writing relatively large datasets under milliseconds.

$ time seq 2000 | sort --random-sort | spark
________________________________________________________
Executed in   27.21 millis    fish           external
   usr time   26.40 millis    0.57 millis   25.83 millis
   sys time    4.87 millis    1.58 millis    3.29 millis

$ time seq 2000 | sort --random-sort | spark.sh


Executed in 2.73 secs fish external usr time 2.72 secs 0.33 millis 2.72 secs sys time 0.02 secs 1.47 millis 0.02 secs

License

MIT

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.