mirror of
https://github.com/oh-my-fish/oh-my-fish
synced 2024-11-03 15:40:32 +00:00
+bucaran array.delete
This commit is contained in:
parent
7c9d660f2c
commit
75ba7639a9
8
plugins/fish-spec/array.delete.fish
Normal file
8
plugins/fish-spec/array.delete.fish
Normal file
@ -0,0 +1,8 @@
|
||||
# Remove item from list. List must be the name of a global variable.
|
||||
# @params <item> <list>
|
||||
function array.delete
|
||||
set -l item $argv[1]
|
||||
if set -l index (contains -i -- $item $$argv[2])
|
||||
set -e $argv[2][$index]
|
||||
end
|
||||
end
|
@ -1,7 +0,0 @@
|
||||
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
|
@ -32,13 +32,16 @@ function describe_oh_my_fish
|
||||
end
|
||||
|
||||
function it_loads_all_oh_my_fish_functions
|
||||
remove_from_array "$fish_path/functions/" fish_function_path
|
||||
array.delete "$fish_path/functions/" fish_function_path
|
||||
|
||||
load_oh_my_fish
|
||||
expect $fish_function_path to_include $fish_path/functions/
|
||||
end
|
||||
|
||||
function it_loads_all_selected_plugins
|
||||
remove_from_array "$fish_path/plugins/z" fish_function_path
|
||||
array.delete "$fish_path/plugins/bak" fish_function_path
|
||||
array.delete "$fish_path/plugins/z" fish_function_path
|
||||
|
||||
set fish_plugins bak z
|
||||
load_oh_my_fish
|
||||
expect $fish_function_path to_include $fish_path/plugins/bak and
|
||||
@ -46,7 +49,8 @@ function describe_oh_my_fish
|
||||
end
|
||||
|
||||
function it_loads_the_selected_theme
|
||||
remove_from_array "$fish_path/themes/l" fish_function_path
|
||||
array.delete "$fish_path/themes/l" fish_function_path
|
||||
|
||||
set fish_theme l
|
||||
load_oh_my_fish
|
||||
expect $fish_function_path to_include $fish_path/themes/l
|
||||
@ -57,15 +61,4 @@ function load_oh_my_fish
|
||||
. $fish_path/oh-my-fish.fish
|
||||
end
|
||||
|
||||
function remove_from_array
|
||||
set -l element $argv[1]
|
||||
|
||||
for i in (seq (count $$argv[2]))
|
||||
if test $$argv[2][$i] = $element
|
||||
set -e $argv[2][$i]
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
import plugins/fish-spec
|
||||
|
Loading…
Reference in New Issue
Block a user