feat: add pstf function
This commit is contained in:
parent
ec6c3a92fd
commit
d7c3ccf90f
@ -20,13 +20,18 @@ if status is-interactive
|
||||
alias reboot="systemctl reboot"
|
||||
alias hr="date +'%Hh:%M, %d-%m-%Y'"
|
||||
alias hi="systemctl hibernate"
|
||||
alias ff="fastfetch"
|
||||
alias ff="fastfetch --config examples/19"
|
||||
alias feh="imv"
|
||||
alias lg="lazygit"
|
||||
alias cpr="cd ~/repos/cports-docker && docker compose run --build --rm cports"
|
||||
alias cop="wl-copy"
|
||||
alias poweroff="systemctl poweroff"
|
||||
alias cat="bat"
|
||||
|
||||
alias protontricks='flatpak run com.github.Matoking.protontricks'
|
||||
alias protontricks-launch='flatpak run --command=protontricks-launch com.github.Matoking.protontricks'
|
||||
|
||||
alias generate_token="curl -u jabuxas https://paste.jabuxas.xyz | wl-copy"
|
||||
end
|
||||
|
||||
function pst
|
||||
@ -55,6 +60,32 @@ function pst
|
||||
end
|
||||
end
|
||||
|
||||
function pstf
|
||||
set -l file
|
||||
set -l use_ansifilter false
|
||||
|
||||
if command -v ansifilter > /dev/null
|
||||
set use_ansifilter true
|
||||
end
|
||||
|
||||
if command test -p /dev/stdin
|
||||
set file "/tmp/tmp.txt"
|
||||
if test $use_ansifilter = true
|
||||
ansifilter > $file
|
||||
else
|
||||
cat > $file
|
||||
end
|
||||
else if test -n "$argv[1]"
|
||||
set file "$argv[1]"
|
||||
end
|
||||
|
||||
curl -F "file=@$file" -Fsecret= -H "X-Auth: $(cat ~/.key)" https://paste.jabuxas.xyz
|
||||
|
||||
if command test -p /dev/stdin
|
||||
rm "$file"
|
||||
end
|
||||
end
|
||||
|
||||
function last_history_item
|
||||
echo $history[1]
|
||||
end
|
||||
|
@ -26,7 +26,7 @@ SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrbl
|
||||
SETUVAR fish_color_status:red
|
||||
SETUVAR fish_color_user:brgreen
|
||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||
SETUVAR fish_key_bindings:fish_vi_key_bindings
|
||||
SETUVAR fish_key_bindings:fish_default_key_bindings
|
||||
SETUVAR fish_pager_color_background:\x1d
|
||||
SETUVAR fish_pager_color_completion:B3A06D
|
||||
SETUVAR fish_pager_color_description:B3A06D
|
||||
|
@ -65,20 +65,10 @@ fi
|
||||
|
||||
pst() {
|
||||
local file
|
||||
local use_ansifilter=false
|
||||
|
||||
# Check if ansifilter exists
|
||||
if command -v ansifilter >/dev/null 2>&1; then
|
||||
use_ansifilter=true
|
||||
fi
|
||||
|
||||
if [[ -p /dev/stdin ]]; then
|
||||
file=$(mktemp)
|
||||
if $use_ansifilter; then
|
||||
ansifilter > "$file"
|
||||
else
|
||||
cat > "$file"
|
||||
fi
|
||||
cat > "$file"
|
||||
elif [[ -n $1 ]]; then
|
||||
file="$1"
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user