Verified Commit c876c84b authored by AtjonTV's avatar AtjonTV
Browse files

Update to latest status

parent a4206cbe
......@@ -16,3 +16,7 @@ alias gradle47="/opt/gradle/gradle-4.7/bin/gradle"
alias java8="/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java"
alias antenneradio="mpv --no-video --volume 60 http://live.antenne.at/ak_bk"
alias cp="cp -i"
alias rm="rm -i"
alias mv="mv -i"
# Defines autocompletion for SDKMAN!
# Copyright (c) 2018 Raphael Reitzig
# MIT License (MIT)
# https://github.com/reitzig/sdkman-for-fish
# Guard: SDKMAN! needs to be installed
if not test -f "$HOME/.sdkman/bin/sdkman-init.sh"
exit 0
end
# # # # # #
# Completion trigger predicates
# # # # # #
# Test if there is no command
function __fish_sdkman_no_command
set cmd (commandline -opc)
if [ (count $cmd) -eq 1 ]
return 0
end
return 1
end
# Test if the main command matches one of the parameters
function __fish_sdkman_using_command
set cmd (commandline -opc)
if [ (count $cmd) -eq 2 ]
if contains $cmd[2] $argv
return 0
end
end
return 1
end
function __fish_sdkman_specifying_candidate
set cmd (commandline -opc)
if [ (count $cmd) -eq 3 ] # currently, sdk does not support multiple versions
if contains $cmd[2] $argv
return 0
end
end
return 1
end
function __fish_sdkman_command_has_enough_parameters
set cmd (commandline -opc)
if [ (count $cmd) -ge (math $argv[1] + 2) ]; and contains $cmd[2] $argv[2..-1]
return 0
end
return 1
end
# # # # # #
# Data collectors
# # # # # #
function __fish_sdkman_candidates
cat "$HOME"/.sdkman/var/candidates | tr ',' '\n'
end
function __fish_sdkman_candidates_with_versions
set regexpHome (string replace -a '/' '\\/' "$HOME/")
find "$HOME"/.sdkman/candidates/ -mindepth 2 -maxdepth 2 -name '*current' \
| awk -F '/' '{ print $(NF-1) }' \
| sort -u
end
function __fish_sdkman_installed_versions
set cmd (commandline -opc)
if [ -d "$HOME"/.sdkman/candidates/$cmd[3]/current ]
ls -v1 "$HOME"/.sdkman/candidates/$cmd[3] | grep -v current
end
end
# # # # # #
# Completion specification
# # # # # #
# install
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'i install' \
-d 'Install new version'
complete -c sdk -f -n '__fish_sdkman_using_command i install' \
-a "(__fish_sdkman_candidates)"
complete -c sdk -f -n '__fish_sdkman_specifying_candidate i install' \
# TODO complete available versions --> #4
-a 'a.b.c' \
-d "version list unavailable"
complete -c sdk -f -n '__fish_sdkman_specifying_candidate i install' \
-a 'x.y.z' \
-d "Add your own; specify path!"
# Implicit: complete files as fourth parameter
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 3 i install'
# block
# uninstall
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'rm uninstall' -d 'Uninstall version'
complete -c sdk -f -n '__fish_sdkman_using_command rm uninstall' \
-a "(__fish_sdkman_candidates_with_versions)"
complete -c sdk -f -n '__fish_sdkman_specifying_candidate rm uninstall' \
-a "(__fish_sdkman_installed_versions)"
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 rm uninstall'
# block
# list
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'ls list' \
-d 'List versions'
complete -c sdk -f -n '__fish_sdkman_using_command ls list' \
-a "(__fish_sdkman_candidates)"
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 ls list'
# block
# use
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'u use' \
-d 'Use specific version'
complete -c sdk -f -n '__fish_sdkman_using_command u use' \
-a "(__fish_sdkman_candidates_with_versions)"
complete -c sdk -f -n '__fish_sdkman_specifying_candidate u use' \
-a "(__fish_sdkman_installed_versions)"
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 u use'
# block
# default
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'd default' \
-d 'Set default version'
complete -c sdk -f -n '__fish_sdkman_using_command d default' \
-a "(__fish_sdkman_candidates_with_versions)"
complete -c sdk -f -n '__fish_sdkman_specifying_candidate d default' \
-a "(__fish_sdkman_installed_versions)"
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 d default'
# block
# current
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'c current' \
-d 'Display current version'
complete -c sdk -f -n '__fish_sdkman_using_command c current' \
-a "(__fish_sdkman_candidates)"
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 c current'
# block
# upgrade
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'ug upgrade' \
-d 'Display what is outdated'
complete -c sdk -f -n '__fish_sdkman_using_command ug upgrade' \
-a "(__fish_sdkman_candidates_with_versions)"
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 ug upgrade'
# block
# version
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'v version' \
-d 'Display version'
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 v version'
# block
# broadcast
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'b broadcast' \
-d 'Display broadcast message'
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 b broadcast'
# block
# help
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'h help' \
-d 'Display help message'
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 h help'
# block
# offline
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'offline' \
-d 'Set offline status'
complete -c sdk -f -n '__fish_sdkman_using_command offline' \
-a 'enable' \
-d 'Make sdk work while offline'
complete -c sdk -f -n '__fish_sdkman_using_command offline' \
-a 'disable' \
-d 'Turn on all features'
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 offline'
# block
# selfupdate
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'selfupdate' \
-d 'Update sdk'
complete -c sdk -f -n '__fish_sdkman_using_command selfupdate' \
-a 'force' \
-d 'Force re-install of current version'
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 selfupdate'
# block
# update
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'update' \
-d 'Reload the candidate list'
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 update'
# block
# flush
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'flush' \
-d 'Clear out caches'
complete -c sdk -f -n '__fish_sdkman_using_command flush' \
-a 'broadcast' \
-d 'Re-download news'
complete -c sdk -f -n '__fish_sdkman_using_command flush' \
-a 'archives' \
-d 'Remove downloads'
complete -c sdk -f -n '__fish_sdkman_using_command flush' \
-a 'temp' \
-d 'Clear installation prep folder'
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 flush'
# block
#!/usr/bin/fish
# Makes command and binaries from SDKMAN! available in fish.
# Delegates to bash for the `sdk` command.
# Copyright (c) 2018 Raphael Reitzig
# MIT License (MIT)
# https://github.com/reitzig/sdkman-for-fish
set __fish_sdkman_init "$HOME/.sdkman/bin/sdkman-init.sh"
set __fish_sdkman_noexport_init "$HOME/.config/fisher/github.com/reitzig/sdkman-for-fish/sdkman-noexport-init.sh"
# Guard: SDKMAN! needs to be installed
if not test -f "$__fish_sdkman_init"
exit 0
end
# Hack for issue #19:
# Create version of sdkman-init that doesn't export any environment variables.
# Refresh if sdkman-init changed.
if begin not test -f "$__fish_sdkman_noexport_init";
or env test "$__fish_sdkman_init" -nt "$__fish_sdkman_noexport_init"
end
mkdir -p (dirname $__fish_sdkman_noexport_init)
sed -E -e 's/^(\s*).*(export|to_path).*$/\1:/g' "$__fish_sdkman_init" \
> "$__fish_sdkman_noexport_init"
end
# Runs the given command in bash, capturing some side effects
# and repeating them on the current fish shell.
# Returns the same status code as the given command.
function __fish_sdkman_run_in_bash
# We need to leave stdin and stdout of sdk free for user interaction.
# So, pipe relevant environment variables (which might have changed)
# through a file.
# But since now getting the exit code of sdk itself is a hassle,
# pipe it as well.
#
# TODO: Can somebody get this to work without the overhead of a file?
set pipe (mktemp)
bash -c "$argv[1];
echo -e \"\$?\" > $pipe;
env | grep -e '^SDKMAN_\|^PATH' >> $pipe;
env | grep -i -E \"^(`echo \${SDKMAN_CANDIDATES_CSV} | sed 's/,/|/g'`)_HOME\" >> $pipe;
echo \"SDKMAN_OFFLINE_MODE=\${SDKMAN_OFFLINE_MODE}\" >> $pipe" # it's not an environment variable!
set bashDump (cat $pipe; rm $pipe)
set sdkStatus $bashDump[1]
set bashEnv $bashDump[2..-1]
# If SDKMAN! succeeded, copy relevant environment variables
# to the current shell (they might have changed)
if [ $sdkStatus = 0 ]
for line in $bashEnv
set parts (string split "=" $line)
set var $parts[1]
set value (string join "=" $parts[2..-1])
switch "$var"
case "PATH"
# Special treatment: need fish list instead
# of colon-separated list.
set value (string split : "$value")
end
if test -n value
set -gx $var $value
# Note: This makes SDKMAN_OFFLINE_MODE an environment variable.
# That gives it the behaviour we _want_!
end
end
end
return $sdkStatus
end
# If this is a subshell of a(n initialized) fish owned by the same user,
# no initialization necessary.
# Otherwise:
if not set -q SDKMAN_DIR; or test (ls -ld "$SDKMAN_DIR" | awk '{print $3}') != (whoami)
set -e SDKMAN_DIR
__fish_sdkman_run_in_bash "source $__fish_sdkman_init"
end
#!/usr/bin/fish
set GOPATH /home/atjontv/go
set PATH $GOPATH/bin $PATH
set PATH $PATH /data/atjontv/sdks/flutter/bin
set PATH $PATH /data/atjontv/sdks/dart/bin
set PATH $PATH /opt/gradle/latest/bin
set EPREFIX /data/atjontv/eprefix
set VROOT /data/atjontv/development/vlang
set PATH $PATH /data/scripts/
set PATH $PATH /opt/flutter/bin
set PATH $PATH /opt/gnucobol/bin
set PATH $PATH /opt/freepascal/bin
# GnuCOBOL
set LD_LIBRARY_PATH $LD_LIBRARY_PATH /opt/gnucobol/lib
set KMA_PATH /usr/local/share/kma
set GPG_TTY /dev/pts/3
set -x GPG_TTY (tty)
function fish_greeting
end
......@@ -21,3 +25,6 @@ end
source $HOME/.config/fish/utils.fish
source $HOME/.config/fish/tarzip.fish
source $HOME/.config/fish/aliases.fish
bind \e\[1\;5C forward-word
bind \e\[1\;5D backward-word
......@@ -3,6 +3,9 @@
SETUVAR __fish_classic_git_prompt_initialized:\x1d
SETUVAR __fish_init_2_39_8:\x1d
SETUVAR __fish_init_2_3_0:\x1d
SETUVAR __fish_init_3_x:\x1d
SETUVAR __fish_initialized:3100
SETUVAR _fish_abbr__21_21_:sudo\x20reset
SETUVAR fish_color_autosuggestion:555\x1ebrblack
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:\x2d\x2dbold
......@@ -14,6 +17,7 @@ SETUVAR fish_color_error:brred
SETUVAR fish_color_escape:bryellow\x1e\x2d\x2dbold
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal
SETUVAR fish_color_host_remote:yellow
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue
SETUVAR fish_color_normal:normal
SETUVAR fish_color_operator:bryellow
......
joseluisq/gitnow@2.1.1
fishpkg/fish-git-util
reitzig/sdkman-for-fish
function sudobangbang --on-event fish_postexec
abbr !! sudo $argv[1]
end
function logout
qdbus org.kde.ksmserver /KSMServer logout 0 0 0
end
function ports
netstat -tulpn | grep LISTEN
end
function sdk -d "Manage SDKs"
# Guard: SDKMAN! needs to be installed
if not test -f "$__fish_sdkman_init"
# Propose to install SDKMAN!
function read_confirm
while true
read -l -P "$argv[1] [y/N] " confirm
switch $confirm
case Y y
return 0
case '' N n
return 1
end
end
end
if read_confirm "You don't seem to have SDKMAN! installed. Install now?"
if not which curl > /dev/null
echo "curl required"
return 1
end
if not which bash > /dev/null
echo "bash required"
return 1
end
curl -s "https://get.sdkman.io" | bash | sed '/All done!/q'
echo "Please open a new terminal/shell to load SDKMAN!"
end
else
# Declare the _actual_ sdk command for fish
__fish_sdkman_run_in_bash "source \"$__fish_sdkman_noexport_init\" && sdk $argv"
end
end
......@@ -11,3 +11,5 @@ end
function mvntag
git tag (printf "%06d" (echo (git tag | tail -n1)"+1" | bc)) -m "Tag: 0x"(printf "%05x" (echo (git tag | tail -n1)"+1" | bc))" of 0xf423f"
end
alias rdesk="rdesktop -g 1920x1050 -P -z -k de -x l -r sound:off -u administrator"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment