feat: add service:links command

This allows users to script against apps that are linked to a given service
This commit is contained in:
Jose Diaz-Gonzalez
2019-07-15 14:59:05 -07:00
parent fcbf0ef22c
commit c7f511c5f2
2 changed files with 37 additions and 1 deletions

View File

@@ -468,7 +468,7 @@ service_link() {
}
service_linked_apps() {
declare desc="Lists all applications linked to a service"
declare desc="Lists all apps linked to a service for info output"
declare SERVICE="$1"
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
local LINKS_FILE="$SERVICE_ROOT/LINKS"
@@ -479,6 +479,18 @@ service_linked_apps() {
tr '\n' ' ' <"$LINKS_FILE"
}
service_links() {
declare desc="Lists all apps linked to a service"
declare SERVICE="$1"
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
local LINKS_FILE="$SERVICE_ROOT/LINKS"
touch "$LINKS_FILE"
[[ -z $(<"$LINKS_FILE") ]] && return 0
cat "$LINKS_FILE"
}
service_list() {
declare desc="Lists all services and their status"
local SERVICES=$(ls "$PLUGIN_DATA_ROOT" 2>/dev/null)