add fish config

This commit is contained in:
FlintyLemming
2025-12-19 15:51:34 +08:00
parent 1d742a8974
commit 5ea79aac01
3 changed files with 111 additions and 53 deletions

24
bin/zp Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env fish
# 把之前定义的 zp 函数内容贴进来,去掉外层的 function/end
set -l arg_count (count $argv)
# 检查是否有输入参数
if test $arg_count -eq 0
echo "用法: zp <文件或目录1> [文件或目录2] ..."
return 1
end
if test $arg_count -eq 1
# 逻辑 A单个参数保持原样生成同名 zip
set -l name (string trim -r -c / $argv[1])
set -l target "$name.zip"
echo "🚀 正在多线程压缩单项目: $target"
7z a -tzip -mmt=on -mx=5 "$target" "$argv[1]"
else
# 逻辑 B多个参数生成 package_20251219_1540.zip
set -l timestamp (date "+%Y%m%d_%H%M%S")
set -l target "package_$timestamp.zip"
echo "🚀 正在将 $arg_count 个项目打包至: $target"
# 直接传入 $argv7z 会自动处理多个路径
7z a -tzip -mmt=on -mx=5 "$target" $argv
end