added functions

This commit is contained in:
Hannes
2026-02-10 17:29:19 +01:00
parent 4e84944754
commit 949d76123b
4 changed files with 38 additions and 0 deletions

5
functions/addpaths.fish Normal file
View File

@@ -0,0 +1,5 @@
function addpaths
contains -- $argv $fish_user_paths
or set -U fish_user_paths $fish_user_paths $argv
echo "Updated PATH: $PATH"
end

10
functions/findstr.fish Normal file
View File

@@ -0,0 +1,10 @@
function findstr
if test (count $argv) -lt 1
echo "Usage: findstr <search-string>"
return 1
end
set query $argv[1]
find . -type f -exec grep -Hn "$query" {} \;
end

View File

@@ -0,0 +1,8 @@
function removepath
if set -l index (contains -i $argv[1] $PATH)
set --erase --universal fish_user_paths[$index]
echo "Updated PATH: $PATH"
else
echo "$argv[1] not found in PATH: $PATH"
end
end

15
functions/search.fish Normal file
View File

@@ -0,0 +1,15 @@
function search
if test (count $argv) -lt 1
echo "Usage: search <string> [directory]"
return 1
end
set query $argv[1]
set dir "."
if test (count $argv) -ge 2
set dir $argv[2]
end
rg "$query" "$dir"
end