1
0
Fork 0

update flake

This commit is contained in:
cătălin 2025-06-26 12:57:36 +02:00
commit 34c3e678eb
No known key found for this signature in database
7 changed files with 109 additions and 75 deletions

View file

@ -76,3 +76,46 @@ function gur
git reset "HEAD@{$argv[1]}"
end
function nix_upgrade
sudo nix flake update --flake /home/catalin/.dotfiles/nix/
sudo nixos-rebuild switch --flake /home/catalin/.dotfiles/nix/ --upgrade
end
function delete_line
if test (count $argv) -lt 2
echo "Usage: delete_line <file> <line_number> [--backup]"
return 1
end
set file $argv[1]
set line_num $argv[2]
set make_backup false
if contains -- --backup $argv
set make_backup true
end
if not test -f $file
echo "Error: File '$file' does not exist"
return 1
end
if not string match -qr '^\d+$' $line_num
echo "Error: Line number must be a positive integer"
return 1
end
set total_lines (wc -l < $file)
if test $line_num -gt $total_lines
echo "Error: Line $line_num does not exist (file has only $total_lines lines)"
return 1
end
if test $make_backup = true
cp $file $file.bak
echo "Backup created: $file.bak"
end
sed -i "$line_num"d $file
echo "Deleted line $line_num from $file"
end