jorgebucaran / fisher Goto Github PK
View Code? Open in Web Editor NEWA plugin manager for Fish
Home Page: https://git.io/fisher
License: MIT License
A plugin manager for Fish
Home Page: https://git.io/fisher
License: MIT License
Related #10
Currently, only plugins in the Index are being used when doing searches / queries, both remote or local.
You can install / uninstall anything with a .fish
extension and URL or short URL like:
owner/repo # default is github.com
gh:owner/repo # github
bb:owner/repo # bitbucket
gl:owner/repo # gitlab
But Fisherman can't retrieve record information (name, url, info, tags and tags) from plugins installed like this (for lack of a better name these are known as orphans). Since Fisherman can't retrieve any information they do not show on searches.
The next milestone should include the ability to generate this information from the Git repository.
Here is how it works. Essentially I will add a new private function __fisher_plugin_source
that simply evaluates a file like source $file
. Plugins can then override this function to modify the install procedure.
The theme https://github.com/er0/lolfish is broken if you don't have TMUX.
So, I forked it and fixed it. But then I need to remove the originally installed lolfish
and then install the fork in order to test it. It would be great if Fisherman just knew what to do here.
If you install a plugin, then uninstall it, you can repeat the fisher uninstall pluginname
command as many times as you like and it continues to "uninstall" it. I think this is because uninstalling leaves the plugin in the cache, and fisher uninstall
is happy to "uninstall" anything in the cache.
kevin@Erebor ~> fisher install shark
Installing >> shark
Aye! 1 plugin/s installed in 1s
kevin@Erebor ~> fisher uninstall shark
Uninstalling >> shark
Aye! 1 plugin/s uninstalled in 0s
kevin@Erebor ~> fisher uninstall shark
Uninstalling >> shark
Aye! 1 plugin/s uninstalled in 0s
This is a bug introduced in the last release where search fails to check whether there is a Git repo in the path currently being processed when local paths are installed using the fisher install <path>
.
EDIT: Added AWESOME to title, because site must be awesome.
Thanks Dominik for letting me know.
~/D/Projects $ curl -L install.fisherman.sh | fish
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 188 0 188 0 0 431 0 --:--:-- --:--:-- --:--:-- 432
100 88 100 88 0 0 89 0 --:--:-- --:--:-- --:--:-- 259
Cloning into 'fisherman'...
remote: Counting objects: 523, done.
remote: Compressing objects: 100% (249/249), done.
remote: Total 523 (delta 112), reused 0 (delta 0), pack-reused 270
Receiving objects: 100% (523/523), 447.22 KiB | 260.00 KiB/s, done.
Resolving deltas: 100% (204/204), done.
Checking connectivity... done.
Adding configuration to ~/.config/fish/config.fish
Downloading the index for the first time...
fish: Could not expand string '"$$spinners"'
/Users/nek/Documents/Projects/fisherman/functions/wait.fish (line 68): set spinners "$$spinners"
^
in function 'wait',
called on line 72 of file '/Users/nek/Documents/Projects/fisherman/functions/fisher_update.fish',
with parameter list '--spin=pipe --log=/Users/nek/.config/fisherman/cache/.debug_log
curl --max-time 5 -sS https://raw.githubusercontent.com/fisherman/fisher-index/master/INDEX > /Users/nek/.config/fisherman/cache/.index.tmp
'
in function 'fisher_update',
called on standard input,
with parameter list '--index'
fisher: Connection timeout. Try again.
Ahoy! Reset your shell and type 'fisher <command>'
read: Unknown option 'alias'
/Users/nek/Documents/Projects/fisherman/functions/fisher.fish (line 2): while read -la alias
^
in function 'fisher',
called on standard input,
with parameter list 'help -a'
read − read ‐ read line of input into variables
read ‐ read line of input into variables
Synopsis
read [OPTIONS] [VARIABLES...]
read: Type 'help read' for related documentation
Available Commands:
help Show Help
install Install Plugins
search Search Plugins
uninstall Uninstall Plugins
update Update Fisherman or Plugins
Other Documentation:
Use 'fisher help -g' to list guides and other documentation.
See 'fisher help <command or concept>' to access a man page.
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
➜ fisherman git:(master)
To enhance user experience, it would be nice to have a message that notifies when fisherman updates are available, a la bower.
This could be displayed after an install.
It should be silenced if some --quiet
option is enabled, to respet rule of silence.
You could also use a git.io for url shortening.
When I install a new fisher plugin like:
fisher install https://github.com/jonatas/rd-fish
It works only in the same tab I am. If I open a new fish session. It does not load the plugin.
I missed something on my repo to load it in every fish session?
$ fish -v # => fish, version 2.2.0
$ fisher -v # => fisher version 0.4.0
If nothing has been installed, fisher --list
exits with an error and no output. It should instead tell me that there's nothing installed on stderr and exit cleanly. Maybe exiting with code 1 is reasonable, but IIRC it exited with code 127 which is weird (I can't verify since I've already installed something now).
Something like:
Just an idea.
Imo it'd be much cooler if the search output took a single line per package in format pkgname description
. Ideally, table-aligned. I'd love to see smth like fisher info <pkg>
to see more information about a particular package (such as author, last update time, deps, whatever).
$ fisher search
fishtape test tool
shark chart tool
scaffold create plugin generator boilerplate fish fisherman
get stty read line ui cli key character
submit fisherman contrib index plugin
bobthefish theme powerline awesome
Which ones should I use and why?
Here, they say that Wa packages are not compatible with OMF, is this true?
Related:
oh-my-fish/oh-my-fish#212
Quoting @kballard
I think it makes sense to position fisher --list as a plumbing command suitable for use by scripts, so maybe it could do something like list all enabled plugins first with a * prefix (to mean installed) and then all disabled plugins with a space prefix (so it lines up with installed ones), e.g.
fisher --list *shark scaffold
This would be used instead of fisher update --index
by those that need to cause the index to be updated for some reason. For example, make, during install, downloads the index for the first time. In this ocassion, using fisher --update
will schedule the index update as a job in order to show a progress indicator which is not shown by make anyway and causes the install to fail in < fish 2.2.0
.
Related: #48
In config.fish, fisherman currently sources everything in $fisher_config/functions that is named *.config.fish.
Only because $fisher_config/functions is in $fish_function_path, this causes an issue:
What you want to do is the same thing I proposed in fish-shell/fish-shell#2498: Make a new directory for these kinds of always-sourced non-autoloaded non-function files that is not in $fish_function_path.
On C9 Ubuntu machine.
Hi,
maybe I missed something, I tryed fisher install omf/z
and I could not use z.
Also, I added a z.fish file in conf.d/ folder, see my article for complete working instructions. I did not found documentation about conf.d/, I just read the code. Is that ok?
If Fisherman fails to install a package it could offer better help adding something like:
Did you miss the `prefix-` or `theme-`?
In the case of oh-my-fish plugins, or even better, if it fails, then test with plugin-
and if that fails too, test theme-
.
Another thing, it should validate ohm-y-fish
, o-hm-y-fsh
or similar looking URLs to the correct address.
For the moment fisherman is not executing my plugins.
I reinstalled it but the problem still persist.
Another thing is that I tried to uninstall some of the plugins to check if there is a particular one that is generating an error and brakes the initialization chain but it does not seem to be uninstalled:
❯ fisher --cache
/home/rif/.config/fisherman/cache/fasd
/home/rif/.config/fisherman/cache/fzf
/home/rif/.config/fisherman/cache/pure
/home/rif/.config/fisherman/cache/tmux
~
❯ fisher uninstall tmux
Uninstalling >> tmux
1 plugin/s uninstalled (0s)
~
❯ fisher --cache
/home/rif/.config/fisherman/cache/fasd
/home/rif/.config/fisherman/cache/fzf
/home/rif/.config/fisherman/cache/pure
/home/rif/.config/fisherman/cache/tmux
Can you suggest some troubleshooting steps?
Thanks a lot,
-rif
ls $fisher_cache
The above is not terribly bad as a simple way to query the cache, but it would be nice if we could get a list of those packages that were installed using a custom URL. I think a memorable name could be --orphan
.
➡️ This option would be essentially used to add completion to fisher update/uninstall
.
Explanation: The current
fisher search --select=cache
displays all the packages that exist in the cache that Fisherman recognizes and skips those that were installed with a custom URL. The--orphan
would show those packages too.
Fisherman does not use exec fish
to force a shell reset to refresh plugins or prompts, instead, it sources the relevant files and updates the current shell session. Currently, however, prompts are not being sourced.
Fisherman should source all {<the_plugin_name>,fish_{,right_}prompt}.fish
during fisher install
to correctly enable plugins/prompts without a shell restart.
Note: While most prompts work fine, if a prompt (theme) fails to declare any global variables with a -g
flag, the source
mechanism will fail as those variables will be scoped to the parent function (the one who invokes source
)
Related
Semi-Related
There's two uses of mktemp
in fisherman, which work fine on Linux but fail on Mac OS X because mktemp requires the template
argument (see e.g. stackoverflow).
I believe there's two easy solutions. One is to specify a prefix instead, the other is to see if mktemp
failed:
mktemp -t fisher.XXXXXXXX
mktemp 2>/dev/null; or mktemp -t fisher
Either seems to work on Mac OS X (10.9 and 10.10), FreeBSD (9.3), Ubuntu (14.04), and Linux Mint (17.3).
After uninstalling a plugin, fisher --list
continues to list the plugin. It may still be in the cache (though is there any point to caching uninstalled plugins?), and fisher --list
is documented as reporting what's in the cache, but really that command is only useful if it lists the actual installed plugins.
temp ) git clone https://github.com/fisherman/fisherman
Cloning into 'fisherman'...
remote: Counting objects: 94, done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 94 (delta 7), reused 0 (delta 0), pack-reused 72
Unpacking objects: 100% (94/94), done.
Checking connectivity... done.
temp ) cd fisherman
fisherman ) make
Reset your shell to apply changes
fisherman )
And then nothing happend after the shell restart.
I'm using fish with omf.
Fish currently invokes the user function fish_user_key_bindings
whenever the fish_key_bindings
variable changes (and prior to the first prompt being displayed). That's the official customization point for loading in your own keybindings. Anything set manually with bind
will not survive the session, and will also get erased if the user changes the fish_key_bindings
variable.
Unfortunately, this isn't very amenable to a plugin infrastructure, because multiple plugins that want to set keybindings would overwrite each other when setting this function (and would overwrite the user's own keybindings). You can see this in the OMF plugin oh-my-fish/plugin-bang-bang which simply provides its own fish_user_key_bindings
function.
I think Fisherman can do better.
I think the right approach here is for Fisherman to define its own fish_user_key_bindings
function. Since Fisherman puts itself in the fish_function_path
prior to $XDG_CONFIG_HOME/fish/functions
, Fisherman's version will override the user's. Fisherman can also alter the plugin structure to allow for a file named key_bindings.fish
, which will get copied into a new folder $fisher_config/keybindings
when the plugin is installed. Fisherman's fish_user_key_bindings
can then source every file in this folder.
Furthermore, Fisherman's version of functions/fish_user_key_bindings.fish
can explicitly check the remainder of the $fish_function_path
list (everything after the fisherman path) and look for another file called fish_user_key_bindings.fish
; if it finds one, it can source it, then use functions -c
to copy the other fish_user_key_bindings
to some other name. This way it can execute that function at the end of its own fish_user_key_bindings
(so user keybindings will override plugin ones). This way users can still define their own fish_user_key_bindings
functions and it will still be invoked as appropriate; the only real problem is if they modify the file, re-running fish_user_key_bindings
won't reapply it. A possible workaround there is to actually search for the file inside the invocation of fish_user_key_bindings
, but then you have to do weird things like rename Fisherman's version of the function, execute the file, check to make sure it actually defined its own fish_user_key_bindings
function, execute the function, and then rename Fisherman's copy back to the normal name. This sounds doable, but I'm not sure if there's any potential issues there.
I'm actually kind of surprised OMF doesn't already do something like this.
$ fisher update --me
Updating >> Fisherman
test: unexpected argument at index 2: '10 81184 stopped cat | grep -o .'
test: unexpected argument at index 2: '10 81184 stopped cat | grep -o .'
test: unexpected argument at index 2: '10 81184 stopped cat | grep -o .'
test: unexpected argument at index 2: '10 81184 stopped cat | grep -o .'
test: unexpected argument at index 2: '10 81184 stopped cat | grep -o .'
test: unexpected argument at index 2: '10 81184 stopped cat | grep -o .'
It's hard to paste a spinner here, so just imagine it's on the last line.
It keeps waiting for input. Should display usage, I guess.
fisher 0.5.0
The algorithm to enable/disable plugins is essentially the same. The only difference is enable copies/symlinks and disable removes, files from $fisher_config/{functions,confd,completions,man%}
. Other than that, there is some specific logic to unload themes, but that's it.
The next milestone should address this by wrapping this logic and extracting all of that into a generic __fisher_plugin
. Currently the API I am considering is:
__fisher_plugin --disable NAME PATH
__fisher_plugin --enable NAME PATH
I don't know about others but i am feeling lag its not that smooth sometime and their should be something for error management
I find this name not terribly confusing, but I think we could do better.
The current behavior of fisher update
is to install the plugin again.
This is simply by calling fisher install
after the update. This makes sense for a plugin, but perhaps not for a prompt/theme. If you are using prompt X and then fisher update promptZ
, Fisherman will update promptZ
and also set your current prompt to promptZ
.
I have no problem with this, but perhaps we could add an option to fisher update --no-install
or similar.
After several failed attempts to install some plugins my fishfile looks like this:
❯ cat ~/.config/fisherman/fishfile
pure
https://github.com/oh-my-fish/fzf
https://github.com/oh-my-fish/fasd
https://github.com/oh-my-fish/tmux
https://github.com/oh-my-fish/plugin-fzf
fasd
tmux
fzf
We need a way to clean bad plugins from the file.
Due to wait(1)
behavior of always returning 1 if there was output to stderr, git clone
in fisher install
writes to `$fisher_error_log:
warning: --depth is ignored in local clones; use file:// instead.
Fisherman#wait(1)
treats it as an error and we get Repository not found.
error even though the install was succesful.
A simple fix would clear out $fisher_error_log
if git clone
is succesful.
The install process breaks config.fish
when it is a symlink.
$ ls -l ~/.config/fish/config.fish
lrwxrwxrwx 1 daniel daniel 68 Jan 3 18:54 /home/daniel/.config/fish/config.fish -> /home/daniel/.homesick/repos/dot-files/home/.config/fish/config.fish
$ make
Adding configuration to ~/.config/fish/config.fish
Reset your shell to apply changes
$ ls -l ~/.config/fish/config.fish
-rw-r--r-- 1 daniel daniel 512 Jan 3 19:18 /home/daniel/.config/fish/config.fish
The issue is in the last line of $(FISH_CONFIG)
target in the Makefile, which replaces the current config.fish
with a new one.
If you are working on a plugin locally, how do you test it?
First, you can always install it if you have a long url, for example, on OS X
fisher install file://Users/<user>/path/to/plugin
This feature should allow fisher install
to install plugins using any path ~/myplugin
, etc.
After running fisher search
to see the available projects, I tried running fisher install shark scaffold
and it reported the wrong indexes:
kevin@Erebor ~> fisher install shark scaffold
Installing (2 of 2) >> shark
Installing (3 of 2) >> scaffold
fisher: Repository not found: 'https://github.com/bucaran/fish-scaffold'
Aye! 1 plugin/s installed in 3s
fish-scaffold also doesn't seem to exist, but that's a different issue.
Hi, I hope that you could add the image to top of the wiki page https://github.com/fisherman/fisherman/wiki/Performance as I wasn't able to edit it.
By the way, could you show some tips to create that nice image? What did you use?
You probably don't want yet another file in your repo, but I promise this one is good for like 95% of everyone (the other 5% is busy looking at cat pictures).
I've used the contributor covenant in the past, it's pretty easy to read and understand (and translated into a few languages here). Pick the one you like though :)
mdziardziel@PC-076 ~/g/fisherman> make
Adding configuration to ~/.config/fish/config.fish
Downloading the index for the first time...
fish: Could not expand string “"$$spinners"”
/home/mdziardziel/git/fisherman/functions/wait.fish (line 68): set spinners "$$spinners"
^
in function “wait”,
called on line 72 of file “/home/mdziardziel/git/fisherman/functions/fisher_update.fish”,
with parameter list “--spin=pipe --log=/home/mdziardziel/.config/fisherman/cache/.debug_log
curl --max-time 5 -sS https://raw.githubusercontent.com/fisherman/fisher-index/master/INDEX > /home/mdziardziel/.config/fisherman/cache/.index.tmp
”
in function “fisher_update”,
called on standard input,
with parameter list “--index”
fisher: Connection timeout. Try again.
Ahoy! Reset your shell and type 'fisher '
read: Unknown option “alias”
/home/mdziardziel/git/fisherman/functions/fisher.fish (line 2): while read -la alias
^
in function “fisher”,
called on standard input,
with parameter list “help -a”
read - read - read line of input into variables
Looks like something in the awk
script is truncating a portion of my config.fish
when fisherman installs.
Steps to reproduce:
make
.Before:
set --query fish_greeting
and set --erase fish_greeting
if isatty
if test -d ~/.config/fish/environment.d
set environment_configs (find ~/.config/fish/environment.d -type f -name \*.fish)
for config in $environment_configs
source $config
end
end
if test -d ~/.config/fish/functions.d
set function_paths (find $HOME/.config/fish/functions.d -type d -mindepth 1 | grep --invert-match --extended-regexp "$HOME/.config/fish/functions.d(.*/\.)+")
for path in $function_paths
contains $path $fish_function_path
or set fish_function_path $fish_function_path $path
if which -s fasd
function -e fish_preexec __fasd
fasd --proc (fasd --sanitize "$argv") > /dev/null 2>& 1
end
function j
cd (fasd -d -e 'printf %s' "$argv")
end
end
end
end
end
# OPAM configuration
#. /Users/colstrom/.opam/opam-init/init.fish > /dev/null 2> /dev/null or true
After:
set fisher_home ~/src/github.com/fisherman/fisherman
set fisher_config ~/.config/fisherman
source $fisher_home/config.fish
set --query fish_greeting
and set --erase fish_greeting
if isatty
if test -d ~/.config/fish/environment.d
set environment_configs (find ~/.config/fish/environment.d -type f -name \*.fish)
for config in $environment_configs
source $config
end
end
if test -d ~/.config/fish/functions.d
set function_paths (find $HOME/.config/fish/functions.d -type d -mindepth 1 | grep --invert-match --extended-regexp "$HOME/.config/fish/functions.d(.*/\.)+")
for path in $function_paths
contains $path $fish_function_path
or set fish_function_path $fish_function_path $path
if which -s fasd
function -e fish_preexec __fasd
fasd --proc (fasd --sanitize "$argv") > /dev/null 2>& 1
end
function j
cd (fasd -d -e 'printf %s' "$argv")
end
end
# OPAM configuration
#. /Users/colstrom/.opam/opam-init/init.fish > /dev/null 2> /dev/null or true
The following:
fisher uninstall my_theme
Correctly removes the prompt files from $fisher_config/functions
, but does not correctly unload the theme.
Fisherman should completely unload the theme and return to fish default's theme.
When $fisher_cache
is empty the find -L $fisher_cache/* -maxdepth 0 -type d
yields an error as it expands to nothing.
Keeping the index up to date all the time is a feature, but updating the index multiple times in the same session is unncessary.
This can be fixed moving the index update logic to __fisher_update_index
as well as most of the search
command logic to smaller functions. This way, other commands can use these functions as plumbing commands for search without triggering an index update everytime.
This will improve in-session performance somewhat, which is also good.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.