home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 0a8a4c54f57adc267445e3d27e7f0871af900590
parent d3e7420ece8fea26db3c0690f0c5e0ca5f5446d4
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Thu,  6 Sep 2018 14:21:01 +0200

Extract common function somewhere…

… and name it weirdly (starting with a) to make sure it's loaded first

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mfish.nix | 1+
Afish/a_nix_run.fish | 24++++++++++++++++++++++++
Mfish/nix-aliases.fish | 25-------------------------
3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/fish.nix b/fish.nix @@ -8,6 +8,7 @@ eval (${pkgs.direnv}/bin/direnv hook fish) ''; }; + xdg.configFile."fish/conf.d/a_nix_run.fish".source = ./fish/a_nix_run.fish; xdg.configFile."fish/conf.d/nix-aliases.fish".source = ./fish/nix-aliases.fish; xdg.configFile."fish/conf.d/sudope.fish".source = ./fish/sudope.fish; xdg.configFile."fish/functions/sudope.fish".source = ./fish/sudope.function.fish; diff --git a/fish/a_nix_run.fish b/fish/a_nix_run.fish @@ -0,0 +1,24 @@ +function _nix_run_package + set -l s $argv[1] + set -l package (string split ":" $s) + switch (count $package) + case 1 + _nix_run $s $s $argv[2] $argv[3] + case 2 + _nix_run $package[1] $package[2] $argv[2] $argv[3] + end +end + +function _nix_run + set -l c $argv[1] + set -l p $argv[2] + set -l channel $argv[3] + set -l channelsfile $argv[4] + function $c --inherit-variable c --inherit-variable p --inherit-variable channel --inherit-variable channelsfile + set -l cmd nix run + if test -n "$channelsfile" + set cmd $cmd -f $channelsfile + end + eval $cmd $channel.$p -c $c $argv + end +end diff --git a/fish/nix-aliases.fish b/fish/nix-aliases.fish @@ -9,29 +9,4 @@ function _def_nix_run_aliases end end -function _nix_run_package - set -l s $argv[1] - set -l package (string split ":" $s) - switch (count $package) - case 1 - _nix_run $s $s $argv[2] $argv[3] - case 2 - _nix_run $package[1] $package[2] $argv[2] $argv[3] - end -end - -function _nix_run - set -l c $argv[1] - set -l p $argv[2] - set -l channel $argv[3] - set -l channelsfile $argv[4] - function $c --inherit-variable c --inherit-variable p --inherit-variable channel --inherit-variable channelsfile - set -l cmd nix run - if test -n "$channelsfile" - set cmd $cmd -f $channelsfile - end - eval $cmd $channel.$p -c $c $argv - end -end - _def_nix_run_aliases