Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
Merge branch 'MarlinFirmware:2.0.x' into 2.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
0xk1f0 authored Oct 10, 2021
2 parents 3022d83 + 40cb7cf commit 8e01bc7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions buildroot/bin/opt_find
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
#
# opt_find
# Find one or more Marlin options - Configuration lines starting with #define
#

MYNAME=$(basename $0)

[[ $# == 0 ]] && ONE="-h" || ONE=$1

COMM="(//\\s*)?" ; TYPE=""
case "$ONE" in
-d|--disabled )
shift ; COMM="(//\\s*)" ; TYPE="disabled " ;;
-e|--enabled )
shift ; COMM="" ; TYPE="enabled " ;;
-h|--help )
echo "$MYNAME [-d|--disabled|-e|--enabled] STRING ... Find matching Marlin configuration options."
echo ; shift ;;
-* )
echo "Unknown option $ONE" ; shift ;;
esac

while [[ $# > 0 ]]; do
DID=0
for FN in Configuration Configuration_adv; do
FOUND=$( grep -HEn "^\s*${COMM}#define\s+[A-Z0-9_]*${1}" "Marlin/$FN.h" 2>/dev/null )
[[ -n "$FOUND" ]] && { echo "$FOUND" ; DID=1 ; }
done
((DID)) || { echo "ERROR: ${MYNAME} - No ${TYPE}match for ${1}" ; exit 9; }
shift
echo
done

0 comments on commit 8e01bc7

Please sign in to comment.