Skip to content

Commit

Permalink
simplified getting max api locators
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverLok committed Aug 2, 2024
1 parent cb830e5 commit 6267813
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scripts/get_max_api_locators.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ function main() {

local largestLocator=$(grep -R '("-' "${path}" | sed 's/^.*"\(-[0-9]\{3\}\)".*$/\1/' | sort | uniq | tail -n 1)
# Remove input zero padding (so bash does not think the numebr is octal.
local cleanLargestLocator=$(echo "${largestLocator}" | sed 's/^-0*/-/')
local nextLocatorValue=$((cleanLargestLocator - 1))
local nextLocator=$(printf "%s%03d" - ${nextLocatorValue#-})
local cleanLargestLocator=$(echo "${largestLocator}" | sed 's/^-0*/-/g')
local nextLocator=$(printf "%04d" "$((cleanLargestLocator - 1))")

echo -e "Package: $(printf "%-12s" "${dir}"),\tMax Locator: $(printf "%-4s" "${largestLocator}"),\tNext Locator: ${nextLocator}"
done
Expand Down

0 comments on commit 6267813

Please sign in to comment.