Skip to content

Commit

Permalink
Merge pull request #18 from qvicksilver/feat/skip-confirmation
Browse files Browse the repository at this point in the history
feat: Add option skip confirmation when setting device description
  • Loading branch information
kcgthb authored Dec 7, 2024
2 parents bb8937f + 0c28d8d commit 2efbdc0
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ibswinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ Usage: ${0##*/} -d <device> [-T] [-o <$outputs>] [-S <description>]
set info:
-S <description> set device description ($MAX_ND_LEN char max.)
-y skip confirmation
EOU
return 0
Expand All @@ -172,7 +173,8 @@ out=""
dev=""
desc=""
opt_T=0
optspec="hd:To:S:"
opt_y=0
optspec="hd:To:S:y"
while getopts "$optspec" optchar; do
case "${optchar}" in
h|\?)
Expand All @@ -199,6 +201,9 @@ while getopts "$optspec" optchar; do
exit 2
}
;;
y)
opt_y=1
;;
esac
done

Expand Down Expand Up @@ -313,9 +318,11 @@ done <<< "$_regs"
echo "Device: $dev"
echo " Current node description: $cur_nd"
echo " Set node description to : $desc"
read -p ">> Confirm? (y/N) " -n 1 -r
echo
[[ $REPLY =~ ^[Yy]$ ]] || exit 1
[[ "$opt_y" == "0" ]] && {
read -p ">> Confirm? (y/N) " -n 1 -r
echo
[[ $REPLY =~ ^[Yy]$ ]] || exit 1
}
echo -n "Setting new node description... "

# convert string to hex array
Expand Down

0 comments on commit 2efbdc0

Please sign in to comment.