diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4989480 --- /dev/null +++ b/.gitignore @@ -0,0 +1,197 @@ + +# Created by https://www.gitignore.io/api/jetbrains+all,jetbrains+iml,jetbrains +# Edit at https://www.gitignore.io/?templates=jetbrains+all,jetbrains+iml,jetbrains + +### JetBrains ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### JetBrains Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +.idea/**/sonarlint/ + +# SonarQube Plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator/ + +### JetBrains+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff + +# Generated files + +# Sensitive or high-churn files + +# Gradle + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake + +# Mongo Explorer plugin + +# File-based project format + +# IntelliJ + +# mpeltonen/sbt-idea plugin + +# JIRA plugin + +# Cursive Clojure plugin + +# Crashlytics plugin (for Android Studio and IntelliJ) + +# Editor-based Rest Client + +# Android studio 3.1+ serialized cache file + +### JetBrains+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### JetBrains+iml ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff + +# Generated files + +# Sensitive or high-churn files + +# Gradle + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake + +# Mongo Explorer plugin + +# File-based project format + +# IntelliJ + +# mpeltonen/sbt-idea plugin + +# JIRA plugin + +# Cursive Clojure plugin + +# Crashlytics plugin (for Android Studio and IntelliJ) + +# Editor-based Rest Client + +# Android studio 3.1+ serialized cache file + +### JetBrains+iml Patch ### +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + + +# End of https://www.gitignore.io/api/jetbrains+all,jetbrains+iml,jetbrains diff --git a/README.md b/README.md index 3ff2b8c..340f55a 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,8 @@ plugins=(... zsh-edward) ## Usage -This plugin solely contains completion scripts and aliases +This plugin solely contains completion scripts and aliases. +It will allow you to have completion when starting/restarting/stopping services or groups. ### Usage help @@ -70,7 +71,7 @@ Flags: Use "edward [command] --help" for more information about a command. ``` -Some aliases are available through this plugin: +Some aliases are available through this plugin, completion still works when using them: | Alias | Command | | ------------- |-------------| diff --git a/_zsh-edward.sh b/_zsh-edward.sh index b7df8fb..28fe2a5 100644 --- a/_zsh-edward.sh +++ b/_zsh-edward.sh @@ -4,6 +4,7 @@ zstyle ':completion:*:descriptions' format '%B%d%b' zstyle ':completion::complete:edward:*:commands' group-name commands zstyle ':completion::complete:edward:*:arguments' group-name arguments +zstyle ':completion::complete:edward:*:running' group-name running zstyle ':completion::complete:edward:*:groups' group-name groups zstyle ':completion::complete:edward:*:services' group-name services @@ -40,6 +41,15 @@ __describe_commands_arguments() { ##### SECOND ARG FUNCTIONS ######################################################## +__get_current_edward_running() { + local -a running + + running=( $(edward status | grep "RUNNING" | cut -d '|' -f 3 | sed -e "s/[[:space:]]//;/^$/g")) + _describe -t running "Currently running" running && ret=0 + + unset running +} + __get_current_edward_groups() { local -a groups @@ -80,10 +90,18 @@ function _edward() { ;; second_arg) case $target in - start|restart|stop) + stop) + __get_current_edward_running __get_current_edward_groups __get_current_edward_services ;; + start) + __get_current_edward_groups + __get_current_edward_services + ;; + restart) + __get_current_edward_running + ;; tail|tiplog) __get_current_edward_services ;;