summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2022-04-16 11:33:31 +0000
committerGitHub <noreply@github.com>2022-04-16 11:33:31 +0000
commit8cf3f1c0778c3d91dd33f086c7ab81c91bf0dff1 (patch)
treee71f99a062d49357b0fff263f90cc4e96258e921
parent01019450cfc0310224c5e0a7888302e21d32e807 (diff)
parent9d15bfae99f50e40e9410f8e8e58c5bd5549c1a7 (diff)
Merge pull request #1046 from tastytea/zsh-completion
add Zsh completion
-rw-r--r--CMakeLists.txt1
-rw-r--r--resources/_nheko23
2 files changed, 24 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 049e3b1e..eef3d829 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -743,6 +743,7 @@ if(UNIX AND NOT APPLE)
install (FILES "resources/nheko.svg" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps" RENAME "nheko.svg")
install (FILES "resources/nheko.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
install (FILES "resources/nheko.appdata.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
+ install (FILES "resources/_nheko" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/zsh/site-functions")
if(NOT TARGET uninstall)
configure_file(
diff --git a/resources/_nheko b/resources/_nheko
new file mode 100644
index 00000000..c730b2b3
--- /dev/null
+++ b/resources/_nheko
@@ -0,0 +1,23 @@
+#compdef nheko
+
+_arguments '--help[Displays help on commandline options.]' \
+ '-h[Displays help on commandline options.]' \
+ '--help-all[Displays help including Qt specific options.]' \
+ '--version[Displays version information.]' \
+ '-v[Displays version information.]' \
+ '--debug[Enables debug output.]' \
+ '--profile[Create or select profile.]:profile:_nheko_select_profile' \
+ '-p[Create or select profile.]:profile:_nheko_select_profile'
+
+function _nheko_select_profile()
+{
+ local -a profiles=(default)
+ while read -r line; do
+ [[ ${line} =~ '\\auth\\device_id' ]] && profiles+=(${line%%\\*})
+ done < ${XDG_CONFIG_HOME:-~/.config}/nheko/nheko.conf
+ _values "profile" ${profiles}
+}
+
+# Local Variables:
+# mode: shell-script
+# End: