Annotation of freem/scripts/fmd, revision 1.2
1.1 snw 1: #!/usr/bin/env bash
2:
3: #
1.2 ! snw 4: # $Id: fmd,v 1.1 2025/04/04 18:00:01 snw Exp $
1.1 snw 5: # FreeM dev script wrapper
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: #
1.2 ! snw 27: # $Log: fmd,v $
! 28: # Revision 1.1 2025/04/04 18:00:01 snw
! 29: # *** empty log message ***
! 30: #
1.1 snw 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:
1.2 ! snw 39: source "${SCRIPT_DIR}/_fmd_common.bash"
! 40:
! 41: #echo "Welcome, $(echo ${_fmd_fullname} | awk '{ print $1 }') <${_fmd_email}>!"
! 42: #echo
! 43: #echo "fmd: running on ${_fmd_distribution} ${_fmd_osversion} (${_fmd_kernel} kernel) on ${_fmd_arch}"
! 44: #echo "fmd: this repository contains sources for FreeM ${_fmd_freem_version}"
! 45:
1.1 snw 46: function usage() {
1.2 ! snw 47: echo
! 48: echo "FreeM developer utilities"
! 49: echo
! 50: echo "usage:"
! 51: echo
! 52: echo " ${PGM} <command> [OPTIONS]"
! 53: echo
! 54: echo " <command> is one of the following:"
! 55:
! 56: for FMDCMD in $(_fmd_commands)
! 57: do
! 58: echo " - ${FMDCMD}"
! 59: done
! 60:
! 61: echo
! 62: echo " To get detailed help on an individual fmd command:"
! 63: echo " fmd help <command>"
! 64: echo
1.1 snw 65: exit 1
66: }
67:
68: if [[ $# < 1 ]]
69: then
70: usage
71: fi
72:
73: FMD_COMMAND=$1
74: shift
75:
1.2 ! snw 76: if [[ "${FMD_COMMAND}" == "help" ]]
! 77: then
! 78: if [[ $# == 0 ]]
! 79: then
! 80: usage
! 81: else
! 82: CMDSCRIPT="${SCRIPT_DIR}/fmd-$1"
! 83: FMD_COMMAND="help"
! 84: fi
! 85: else
! 86: CMDSCRIPT="${SCRIPT_DIR}/fmd-${FMD_COMMAND}"
! 87: fi
1.1 snw 88:
89: if [[ ! -x "${CMDSCRIPT}" ]]
1.2 ! snw 90: then
1.1 snw 91: echo "${PGM}: ${FMD_COMMAND} is not a valid command"
92: exit 1
1.2 ! snw 93: fi
1.1 snw 94:
95: case "${FMD_COMMAND}" in
96:
1.2 ! snw 97: help)
! 98: ${CMDSCRIPT} help
! 99: ;;
! 100:
1.1 snw 101: log)
102: ${SCRIPT_DIR}/fmd-log "${SCRIPT_DIR}/${PGM}" "$1"
103: ;;
104:
105: commit)
106: ${SCRIPT_DIR}/fmd-commit "${SCRIPT_DIR}/${PGM}" "$1"
107: ;;
108:
109: *)
110: ${CMDSCRIPT} "${SCRIPT_DIR}/${PGM}" $@
111: ;;
112:
113: esac
114:
115:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>