diff --git a/config-sync/.config/ibus/rime/custom_phrase.txt b/config-sync/.config/ibus/rime/custom_phrase.txt index 21e48d7..9f68ba8 100644 --- a/config-sync/.config/ibus/rime/custom_phrase.txt +++ b/config-sync/.config/ibus/rime/custom_phrase.txt @@ -122,4 +122,6 @@ _(:з」∠)_ tangqiang 1 ꒦ິ^꒦ິ sad 2 Ծ‸Ծ sad 1 (//▽//) shy 2 -٩(//̀Д/́/)۶ shy 1 \ No newline at end of file +٩(//̀Д/́/)۶ shy 1 + +ŋ ng 1 \ No newline at end of file diff --git a/scripts/bin/switch-java b/scripts/bin/switch-java new file mode 100755 index 0000000..6063337 --- /dev/null +++ b/scripts/bin/switch-java @@ -0,0 +1,29 @@ +#!/usr/bin/env python +import sys +import os +import argparse + +def find_java_version(version): + jvm_dir = '/usr/lib/jvm' + available_versions = [d for d in os.listdir(jvm_dir) if version in d and os.path.isdir(os.path.join(jvm_dir, d))] + + if not available_versions: + print(f"Error: Java version {version} not found in {jvm_dir}") + sys.exit(1) + + return os.path.join(jvm_dir, available_versions[0]) + +if __name__ == '__main__': + agupa = argparse.ArgumentParser(description='Switch between installed Java versions. Usage: eval $(switch-java )') + agupa.add_argument('version', help='Java version to switch to') + + args = agupa.parse_args() + version_path = find_java_version(args.version) + + # Create eval script to set JAVA_HOME and update PATH + java_home = version_path + new_path = f"{version_path}/bin:{os.getenv('PATH')}" + + # Output commands for `eval` to execute + print(f"export JAVA_HOME={java_home}") + print(f"export PATH={new_path}") diff --git a/scripts/zshrc.sh b/scripts/zshrc.sh index 2e42e98..8d79b75 100755 --- a/scripts/zshrc.sh +++ b/scripts/zshrc.sh @@ -115,6 +115,10 @@ alias valgrin="valgrind \ --track-origins=yes \ --vgdb=no" +set-java() { + eval "$(switch-java "$1")" +} + upload-daisy() { file="$@" curl -u azalea -F "path=@$file" "https://daisy-ddns.hydev.org/upload\?path\=/"