• Stars
    star
    322
  • Rank 125,705 (Top 3 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

▁▂▄▆▇█▇▆▄▂▁

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=<number> or --max=<number> 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

More Repositories

1

hyperapp

1kB-ish JavaScript framework for building hypertext applications
JavaScript
19,021
star
2

fisher

A plugin manager for Fish
Shell
7,219
star
3

awsm.fish

A curation of prompts, plugins & other Fish treasures 🐚💎
3,819
star
4

cookbook.fish

From Shell to Plate: Savor the Zest of Fish 🦞
1,933
star
5

nvm.fish

The Node.js version manager you'll adore, crafted just for Fish
Shell
1,890
star
6

colorette

🌈Easily set your terminal text color & styles
JavaScript
1,573
star
7

superfine

Absolutely minimal view layer for building web interfaces
JavaScript
1,562
star
8

classcat

Build a class attribute string quickly
JavaScript
901
star
9

getopts

Node.js CLI options parser
JavaScript
634
star
10

hydro

Ultra-pure, lag-free prompt with async Git status—just for Fish
Shell
559
star
11

hyperawesome

A curated list of awesome projects built with Hyperapp + more
490
star
12

twist

Declarative JavaScript Testing
JavaScript
378
star
13

replay.fish

Run Bash commands, replay changes in Fish 🍤
Shell
370
star
14

fishtape

100% pure-Fish test runner
Shell
340
star
15

autopair.fish

Auto-complete matching pairs in the Fish command line
Shell
316
star
16

hyperapp-router

Declarative routing for Hyperapp V1 using the History API.
JavaScript
257
star
17

getopts.fish

Parse CLI options in Fish
Shell
214
star
18

gitio.fish

Create a custom git.io URL
Shell
88
star
19

hyperapp-html

Html helper functions for Hyperapp V1
JavaScript
81
star
20

pyenv

Pyenv support plugin for fish-shell
Shell
62
star
21

humantime.fish

Turn milliseconds into a human-readable string in Fish
Shell
20
star
22

.github

My health files
1
star
23

jorgebucaran.github.io

HTML
1
star