Closed ghost closed 9 years ago
I like the port. I don't know what you mean about adapting it for oh-my-fish
though.
My feeling is that it would be better to add fish support for the spark tool. If they deny it, then I think adding it to oh-my-fish would be the next step.
While still essentially a port, as I have adapted the original formula, it ended up diverging from the original in implementation and other details so as to add support for more separators, garbled up input, etc.
My feeling is that it would be better to add fish support for the spark tool.
I understand what you mean, but if you inspect Spark's source you will quickly discover it's quite verbose in bashisms. In other words, there is no way to add support to the original spark for Fish without spawning bash itself from within a Fish wrapper and that would be slow.
Shark on the other hand was completely built using Fish, while still passing the same tests.
Another thing, anyone feel free to correct if I am missing something, but in order to handle piped input (echo 1 2 3 | shark
), shark must have its own process and it can not be a function.
So, in order to add shark to OMF, the plugin should basically install / uninstall the script. What do you think?
I simply keep my binaries under /usr/local/bin/
, but I need to research what are the best practices for installing shell scripts.
I'm unsure, not sure if it's on oh-my-fish
scope to be a package manager.
I see this could be useful to theme authors wanting to add sparklines to their prompt, the possibilities are endless.
I am open to suggestions. Probably something alike import package/shark
What's inside package/
? Would it be like directory with install scripts for packages?
This is what I was thinking (could be a very bad thought):
require_package shark
would execute a function that would check whether shark
is in your $PATH, if not, would give you a message telling you to run install_package shark
.
Update: install_package
might be too much, but it could echo a package install instructions url, in this case, github's readme.
I like this. Perhaps someone will say this approach it's a bit too naive, but I really can't think what's so bad about it.
In the meantime, a trivial, but risk-free solution would be not adding anything to the $PATH
and simply keep binaries in $fish_path/packages
and have a global variable $pkg
set to this path so as to allow echo 1 2 3 | $pkg/shark
EDIT: This would require eval $pkg/shark 1 2 3
. So, no.
I think it's a simple way to make sure we have the package installed, and I can see this being used for more packages (we already have themes that requires some). And if the packages are not included we can do two things:
I caught this on your test/helper.fish
. Error message like this?
set -l fish_tank /usr/local/share/fish-tank/tank.fish
if not test -e $fish_tank
echo 'error: fish-tank is required to run these tests (https://github.com/terlar/fish-tank)'
exit 1
end
source $fish_tank
I think an error message like that would be great.
Thoughts? It would make a nice plugin maybe?
$ shark 0,30,55,80,33,150
▁▂▃▄▂█
I was thinking about it, and I don't know what would the plugin contain. As you said we need it to be a binary file, basically to use shark, we just need to download the binary and add it to the path.
Should we handle it? What would be the plugin responsabilities?
Right. A plugin for shark does not make much sense, but a plugin to handle binaries / packages does.
Oh-my-fish is the fish framework. It's what should come next after installing fish
.
How should oh-my-fish handle binaries? get
or fetch
: a plugin to search a central registry sea
or ocean
; download and install fish binaries nuggets
. Just thinking out loud here.
get shark
→ Connecting to ocean registry...
Downloading `bucaran/shark`
`shark` installed to `usr/local/bin` ✓
What about brew
? apt-get
? They handle it so nicely, plus, they are shell agnostic.
I don't think it's worth redoing what other established tools already do.
The solution I see for this is to create an external plugin and embedding shark inside of the plugin, see https://github.com/bpinto/oh-my-fish/issues/259
:+1:
shark
A fish port of spark.
Install
Summary
Parse a string or stream of characters and generate sparklines for any real positive numbers in a dataset.
I would like to adapt shark for Oh-My-Fish.
What do you think?