scripts/common.sh: Add first_word() helper

This commit is contained in:
Kamil Śliwak 2021-12-09 14:10:14 +01:00
parent 248bc387cd
commit 91ee0ed4ef

View File

@ -226,7 +226,16 @@ function circleci_step_selected
{
local selected_steps="$1"
local step="$2"
(( $# == 2 )) || assertFail
[[ $step != *" "* ]] || assertFail "Step names must not contain spaces."
[[ " $selected_steps " == *" $step "* ]] || return 1
}
function first_word
{
local words="$1"
(( $# == 1 )) || assertFail
echo "$words" | cut -d " " -f 1
}