export PATH="$PATH:/Users/$USER/Documents/scripts:/Users/$USER/.dotnet/tools"
export HOMEBREW_CASK_OPTS="--no-quarantine"

export PAGER="less"
export EDITOR="subl -nw"
export VISUAL="$EDITOR"

if type brew &>/dev/null; then
  FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH

  autoload -Uz compinit
  compinit
fi

checkin () {
  curl -H "Authorization: Bearer $(cat ~/.os-bootstrap/secrets/travelynx_token)" -d '{"reason": "ping", "status": {"checkedIn": true, "train": {"type": "'$1'", "no": "'$2'"}, "toStation": {"name": "'$3'"}}}' https://zotan.pw/travelynx.php
}

# editor aliases
alias vi="$EDITOR"
alias vim="$EDITOR"
alias nano="$EDITOR"
alias emacs="$EDITOR"
alias emacsclient="$EDITOR"

# system tool aliases
alias mtr="sudo mtr -z"

# dotnet project aliases
alias 'nat64decode'='/Users/zotan/Projects/nat64decode/bin/Release/net7.0/osx-arm64/publish/nat64decode'
alias 'tgcli'='dotnet run -v q --project ~/Projects/tgcli/tgcli/ -- -s -l'

# wireguard tunnel management aliases
alias 'wg-up'='sudo wg-quick up uplink'
alias 'wg-down'='sudo wg-quick down uplink'
alias 'wg-reconnect'='sudo wg-quick down uplink && sudo wg-quick up uplink'

# dotnet autocompile aliases
## compression for macos-arm64 disabled because it builds broken binaries
alias dotnet-autocompile='dotnet publish --self-contained -p:PublishSingleFile=true -p:DebugType=embedded -p:EnableCompressionInSingleFile=false -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:TrimmerSingleWarn=false -p:SuppressTrimAnalysisWarnings=false -p:DebuggerSupport=false -c Release -r osx-arm64 && dotnet publish --self-contained -p:PublishSingleFile=true -p:DebugType=embedded -p:EnableCompressionInSingleFile=true -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:TrimmerSingleWarn=false -p:SuppressTrimAnalysisWarnings=false -p:DebuggerSupport=false -c Release -r osx-x64 && dotnet publish --self-contained -p:PublishSingleFile=true -p:DebugType=embedded -p:EnableCompressionInSingleFile=true -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:TrimmerSingleWarn=false -p:SuppressTrimAnalysisWarnings=false -p:DebuggerSupport=false -c Release -r linux-x64 && dotnet publish --self-contained -p:PublishSingleFile=true -p:DebugType=embedded -p:EnableCompressionInSingleFile=true -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:TrimmerSingleWarn=false -p:SuppressTrimAnalysisWarnings=false -p:DebuggerSupport=false -c Release -r win-x64'
alias dotnet-autocompile-notrim='dotnet publish --self-contained -p:PublishSingleFile=true -p:DebugType=embedded -p:EnableCompressionInSingleFile=false -p:PublishReadyToRun=true -p:TrimmerSingleWarn=false -p:SuppressTrimAnalysisWarnings=false -p:DebuggerSupport=false -c Release -r osx-arm64 && dotnet publish --self-contained -p:PublishSingleFile=true -p:DebugType=embedded -p:EnableCompressionInSingleFile=true -p:PublishReadyToRun=true -p:TrimmerSingleWarn=false -p:SuppressTrimAnalysisWarnings=false -p:DebuggerSupport=false -c Release -r osx-x64 && dotnet publish --self-contained -p:PublishSingleFile=true -p:DebugType=embedded -p:EnableCompressionInSingleFile=true -p:PublishReadyToRun=true -p:TrimmerSingleWarn=false -p:SuppressTrimAnalysisWarnings=false -p:DebuggerSupport=false -c Release -r linux-x64 && dotnet publish --self-contained -p:PublishSingleFile=true -p:DebugType=embedded -p:EnableCompressionInSingleFile=true -p:PublishReadyToRun=true -p:TrimmerSingleWarn=false -p:SuppressTrimAnalysisWarnings=false -p:DebuggerSupport=false -c Release -r win-x64'
alias dotnet-autocompile-maconly='dotnet publish --self-contained -p:PublishSingleFile=true -p:DebugType=embedded -p:EnableCompressionInSingleFile=false -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:TrimmerSingleWarn=false -p:SuppressTrimAnalysisWarnings=false -p:DebuggerSupport=false -c Release -r osx-arm64'
alias dotnet-autocompile-maconly-notrim='dotnet publish --self-contained -p:PublishSingleFile=true -p:DebugType=embedded -p:EnableCompressionInSingleFile=false -p:PublishReadyToRun=true -p:TrimmerSingleWarn=false -p:SuppressTrimAnalysisWarnings=false -p:DebuggerSupport=false -c Release -r osx-arm64'
