style: improve function description

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
th33xitus
2022-08-15 13:18:18 +02:00
parent 7c4b413c67
commit e12eba95bb

View File

@@ -670,13 +670,21 @@ function set_hostname() {
#============ INSTANCE MANAGEMENT ===============# #============ INSTANCE MANAGEMENT ===============#
#================================================# #================================================#
### this function takes in the full path of a systemd service file and returns ###
### either the instance index or the custom name # takes in a systemd service files full path and
### input: /etc/systemd/system/klipper-name.service # returns the sub-string with the instance name
### returns: name #
# @param {string}: service file absolute path
# (e.g. '/etc/systemd/system/klipper-<name>.service')
#
# => return sub-string containing only the <name> part of the full string
#
function get_instance_name() { function get_instance_name() {
local instance=${1} name local instance=${1}
local name
name=$(echo "${instance}" | rev | cut -d"/" -f1 | cut -d"." -f2 | cut -d"-" -f1 | rev) name=$(echo "${instance}" | rev | cut -d"/" -f1 | cut -d"." -f2 | cut -d"-" -f1 | rev)
echo "${name}" echo "${name}"
} }