File:  [Coherent Logic Development] / freem / scripts / fmd-todo
Revision 1.1: download - view: text, annotated - select for diffs
Thu Apr 10 02:17:49 2025 UTC (3 months, 3 weeks ago) by snw
Branches: MAIN
CVS tags: HEAD
Add fmd-todo

    1: #!/usr/bin/env bash
    2: 
    3: #
    4: #   $Id: fmd-todo,v 1.1 2025/04/10 02:17:49 snw Exp $
    5: #    Find files that need work
    6: #
    7: #  
    8: #   Author: Serena Willis <snw@coherent-logic.com>
    9: #    Copyright (C) 2025 Coherent Logic Development LLC
   10: #
   11: #
   12: #   This file is part of FreeM.
   13: #
   14: #   FreeM is free software: you can redistribute it and/or modify
   15: #   it under the terms of the GNU Affero Public License as published by
   16: #   the Free Software Foundation, either version 3 of the License, or
   17: #   (at your option) any later version.
   18: #
   19: #   FreeM is distributed in the hope that it will be useful,
   20: #   but WITHOUT ANY WARRANTY; without even the implied warranty of
   21: #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   22: #   GNU Affero Public License for more details.
   23: #
   24: #   You should have received a copy of the GNU Affero Public License
   25: #   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
   26: #
   27: #   $Log: fmd-todo,v $
   28: #   Revision 1.1  2025/04/10 02:17:49  snw
   29: #   Add fmd-todo
   30: #
   31: #
   32: # SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
   33: # SPDX-License-Identifier: AGPL-3.0-or-later
   34: #
   35: 
   36: PGM=$(basename $0)
   37: SCRIPT_DIR=$(dirname "$0")
   38: 
   39: source "${SCRIPT_DIR}/_fmd_common.bash"
   40: 
   41: function usage() {
   42:     echo
   43:     echo "Finds FreeM source files with TODO comments"
   44:     echo    
   45:     echo "usage:  "
   46:     echo
   47:     echo "  fmd todo"
   48:     echo
   49:     exit 0
   50: }
   51: 
   52: if [[ $1 == "help" ]]
   53: then
   54:     usage
   55: fi
   56: 
   57: if [[ $# == 0 ]]
   58: then
   59:     echo "lint:  must be run from 'fmd lint'"
   60:     exit 1
   61: fi
   62: 
   63: FMD=$1
   64: 
   65: for FILE in src/*.[ch]
   66: do
   67:     grep "TODO:" "${FILE}" &> /dev/null
   68:     if [[ $? == 0 ]]
   69:     then
   70:         TMPF=$(mktemp)
   71:         cat "${FILE}" | nl -ba > ${TMPF}
   72:         echo "${FILE}:"
   73:         while read LINE
   74:         do
   75:             LNO=$(echo "${LINE}" | awk '{ print $1 }')
   76:             echo "${LINE}" | grep "TODO:" &> /dev/null
   77:             if [[ $? == 0 ]]
   78:             then
   79:                 RPART=$(echo "${LINE}" | cut -d: -f2 | sed 's/\*\///g')
   80:                 printf "\t- %s:  %s\n" "${LNO}" "${RPART}"
   81:             fi
   82:         done < "${TMPF}"
   83:         rm -f "${TMPF}"
   84:     fi
   85: done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>