nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

flatcc-doc.sh (876B)


      1 #!/bin/sh
      2 
      3 HOME=$(dirname $0)/..
      4 SCHEMA=${SCHEMA:-$1}
      5 PREFIX=${PREFIX:-$2}
      6 OUTDIR=${OUTDIR:-$3}
      7 OUTDIR=${OUTDIR:-'.'}
      8 INCLUDE=${INCLUDE:-$HOME/include}
      9 FLATCC=${FLATCC:-$HOME/bin/flatcc}
     10 
     11 if [ "x$SCHEMA" = "x" ]; then
     12     echo "Missing schema arg"
     13     echo "usage: $(basename $0) schema-file name-prefix [outdir]"
     14     exit 1
     15 fi
     16 
     17 if [ "x$PREFIX" = "x" ]; then
     18     echo "Missing prefix arg"
     19     echo "usage: $(basename $0) schema-file name-prefix [outdir]"
     20     exit 1
     21 fi
     22 
     23 echo "flatcc doc for schema: '$SCHEMA' with name prefix: '$PREFIX'"
     24 
     25 echo "generating $OUTDIR/$PREFIX.doc"
     26 
     27 $FLATCC $SCHEMA -a --json --stdout | \
     28     clang - -E -DNDEBUG -I $INCLUDE | \
     29     clang-format -style="WebKit" | \
     30     grep "^static.* $PREFIX\w*(" | \
     31     cut -f 1 -d '{' | \
     32     grep -v deprecated | \
     33     grep -v ");$" | \
     34     sed 's/__tmp//g' | \
     35     sed 's/)/);/g' \
     36     > $OUTDIR/$PREFIX.doc