Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | set -e |
| 4 | |
Patrick Williams | a4c9edc | 2020-12-17 21:02:36 -0600 | [diff] [blame] | 5 | # Locale can change behavior of utilities like 'sort' but we want the output |
| 6 | # to be stable on all machines. Force the locale to 'C' for consistency. |
| 7 | export LC_ALL=C |
| 8 | |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 9 | function show_usage { |
| 10 | cat \ |
Patrick Williams | 9ede18b | 2022-03-12 07:55:36 -0600 | [diff] [blame] | 11 | << EOF |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 12 | Usage: $(basename "$0") [options] <command-args>* |
| 13 | |
| 14 | Generate meson.build files from a directory tree containing YAML files and |
| 15 | facilitate building the sdbus++ sources. |
| 16 | |
| 17 | Options: |
| 18 | --help - Display this message |
| 19 | --command <cmd> - Command mode to execute (default 'meson'). |
| 20 | --directory <path> - Root directory of the YAML source (default '.'). |
| 21 | --output <path> - Root directory of the output (default '.'). |
| 22 | --tool <path> - Path to the processing tool (default 'sdbus++'). |
| 23 | --version - Display this tool's version string. |
| 24 | |
| 25 | Commands: |
| 26 | meson - Generate a tree of meson.build files corresponding |
| 27 | to the source YAML files. |
| 28 | cpp <intf> - Generate the source files from a YAML interface. |
| 29 | markdown <intf> - Generate the markdown files from a YAML interface. |
| 30 | version - Display this tool's version string. |
| 31 | |
| 32 | EOF |
| 33 | } |
| 34 | |
| 35 | ## The version is somewhat arbitrary but is used to create a warning message |
| 36 | ## if a repository contains old copies of the generated meson.build files and |
| 37 | ## needs an update. We should increment the version number whenever the |
| 38 | ## resulting meson.build would change. |
William A. Kennington III | a42e97a | 2021-05-17 18:33:14 -0700 | [diff] [blame] | 39 | tool_version="sdbus++-gen-meson version 3" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 40 | function show_version { |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 41 | echo "${tool_version}" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | # Set up defaults. |
| 45 | sdbuspp="sdbus++" |
| 46 | outputdir="." |
| 47 | cmd="meson" |
| 48 | rootdir="." |
| 49 | |
| 50 | # Parse options. |
| 51 | options="$(getopt -o hc:d:o:t:v --long help,command:,directory:,output:,tool:,version -- "$@")" |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 52 | eval set -- "${options}" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 53 | |
Patrick Williams | 9ede18b | 2022-03-12 07:55:36 -0600 | [diff] [blame] | 54 | while true; do |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 55 | case "$1" in |
| 56 | -h | --help) |
| 57 | show_usage |
| 58 | exit |
| 59 | ;; |
| 60 | |
| 61 | -c | --command) |
| 62 | shift |
| 63 | cmd="$1" |
| 64 | shift |
| 65 | ;; |
| 66 | |
| 67 | -d | --directory) |
| 68 | shift |
| 69 | rootdir="$1" |
| 70 | shift |
| 71 | ;; |
| 72 | |
| 73 | -o | --output) |
| 74 | shift |
| 75 | outputdir="$1" |
| 76 | shift |
| 77 | ;; |
| 78 | |
| 79 | -t | --tool) |
| 80 | shift |
| 81 | sdbuspp="$1" |
| 82 | shift |
| 83 | ;; |
| 84 | |
| 85 | -v | --version) |
| 86 | show_version |
| 87 | exit |
| 88 | ;; |
| 89 | |
| 90 | --) |
| 91 | shift |
| 92 | break |
| 93 | ;; |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 94 | |
| 95 | *) |
| 96 | echo "Invalid argument $1" |
| 97 | exit 1 |
| 98 | ;; |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 99 | esac |
| 100 | done |
| 101 | |
| 102 | ## Create an initially empty meson.build file. |
| 103 | ## $1 - path to create meson.build at. |
| 104 | function meson_empty_file { |
| 105 | mkdir -p "$1" |
| 106 | echo "# Generated file; do not modify." > "$1/meson.build" |
| 107 | } |
| 108 | |
| 109 | ## Create the root-level meson.build |
| 110 | ## |
| 111 | ## Inserts rules to run the available version of this tool to ensure the |
| 112 | ## version has not changed. |
| 113 | function meson_create_root { |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 114 | meson_empty_file "${outputdir}" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 115 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 116 | cat >> "${outputdir}/meson.build" \ |
Patrick Williams | 9ede18b | 2022-03-12 07:55:36 -0600 | [diff] [blame] | 117 | << EOF |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 118 | sdbuspp_gen_meson_ver = run_command( |
| 119 | sdbuspp_gen_meson_prog, |
| 120 | '--version', |
| 121 | ).stdout().strip().split('\n')[0] |
| 122 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 123 | if sdbuspp_gen_meson_ver != '${tool_version}' |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 124 | warning('Generated meson files from wrong version of sdbus++-gen-meson.') |
| 125 | warning( |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 126 | 'Expected "${tool_version}", got:', |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 127 | sdbuspp_gen_meson_ver |
| 128 | ) |
| 129 | endif |
| 130 | |
| 131 | EOF |
| 132 | } |
| 133 | |
| 134 | ## hash-tables to store: |
| 135 | ## meson_paths - list of subdirectory paths for which an empty meson.build |
| 136 | ## has already been created. |
| 137 | ## interfaces - list of interface paths which a YAML has been found and |
| 138 | ## which YAML types (interface, errors, etc.). |
| 139 | declare -A meson_paths |
| 140 | declare -A interfaces |
| 141 | |
| 142 | ## Ensure the meson.build files to a path have been created. |
| 143 | ## $1 - The path requiring to be created. |
| 144 | function meson_create_path { |
| 145 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 146 | meson_path="${outputdir}" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 147 | prev_meson_path="" |
| 148 | |
| 149 | # Split the path into segments. |
Patrick Williams | 9ede18b | 2022-03-12 07:55:36 -0600 | [diff] [blame] | 150 | for part in $(echo "$1" | tr '/' '\n'); do |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 151 | prev_meson_path="${meson_path}" |
| 152 | meson_path="${meson_path}/${part}" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 153 | |
| 154 | # Create the meson.build for this segment if it doesn't already exist. |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 155 | if [[ "" == "${meson_paths[${meson_path}]}" ]]; then |
| 156 | meson_paths["${meson_path}"]="1" |
| 157 | meson_empty_file "${meson_path}" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 158 | |
| 159 | # Add the 'subdir' link into the parent's meson.build. |
| 160 | # We need to skip adding the links into the 'root' meson.build |
| 161 | # because most repositories want to selectively add TLDs based |
| 162 | # on config flags. Let them figure out their own logic for that. |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 163 | if [[ ${outputdir} != "${prev_meson_path}" ]]; then |
| 164 | echo "subdir('${part}')" >> "${prev_meson_path}/meson.build" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 165 | fi |
| 166 | fi |
| 167 | done |
| 168 | } |
| 169 | |
| 170 | ## Generate the meson target for the source files (.cpp/.hpp) from a YAML |
| 171 | ## interface. |
| 172 | ## |
| 173 | ## $1 - The interface to generate a target for. |
| 174 | function meson_cpp_target { |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 175 | mesondir="${outputdir}/$1" |
| 176 | yamldir="$(realpath --relative-to="${mesondir}" "${rootdir}")" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 177 | |
| 178 | # Determine the source and output files based on the YAMLs present. |
| 179 | sources="" |
| 180 | outputs="" |
Patrick Williams | 9ede18b | 2022-03-12 07:55:36 -0600 | [diff] [blame] | 181 | for s in ${interfaces[$1]}; do |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 182 | sources="'${yamldir}/$1.${s}', " |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 183 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 184 | case "${s}" in |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 185 | errors.yaml) |
| 186 | outputs="${outputs}'error.cpp', 'error.hpp', " |
| 187 | ;; |
| 188 | |
| 189 | interface.yaml) |
| 190 | outputs="${outputs}'server.cpp', 'server.hpp', " |
| 191 | outputs="${outputs}'client.hpp', " |
| 192 | ;; |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 193 | |
| 194 | *) |
| 195 | echo "Unknown interface type: ${s}" |
| 196 | exit 1 |
| 197 | ;; |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 198 | esac |
| 199 | done |
| 200 | |
| 201 | # Create the target to generate the 'outputs'. |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 202 | cat >> "${mesondir}/meson.build" \ |
Patrick Williams | 9ede18b | 2022-03-12 07:55:36 -0600 | [diff] [blame] | 203 | << EOF |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 204 | generated_sources += custom_target( |
| 205 | '$1__cpp'.underscorify(), |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 206 | input: [ ${sources} ], |
| 207 | output: [ ${outputs} ], |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 208 | command: [ |
| 209 | sdbuspp_gen_meson_prog, '--command', 'cpp', |
| 210 | '--output', meson.current_build_dir(), |
| 211 | '--tool', sdbusplusplus_prog, |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 212 | '--directory', meson.current_source_dir() / '${yamldir}', |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 213 | '$1', |
| 214 | ], |
| 215 | ) |
| 216 | |
| 217 | EOF |
| 218 | } |
| 219 | |
| 220 | ## Generate the meson target for the markdown files from a YAML interface. |
| 221 | ## $1 - The interface to generate a target for. |
| 222 | function meson_md_target { |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 223 | mesondir="${outputdir}/$(dirname "$1")" |
| 224 | yamldir="$(realpath --relative-to="${mesondir}" "${rootdir}")" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 225 | |
| 226 | # Determine the source files based on the YAMLs present. |
| 227 | sources="" |
Patrick Williams | 9ede18b | 2022-03-12 07:55:36 -0600 | [diff] [blame] | 228 | for s in ${interfaces[$1]}; do |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 229 | sources="'${yamldir}/$1.${s}', " |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 230 | done |
| 231 | |
| 232 | # Create the target to generate the interface.md file. |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 233 | cat >> "${mesondir}/meson.build" \ |
Patrick Williams | 9ede18b | 2022-03-12 07:55:36 -0600 | [diff] [blame] | 234 | << EOF |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 235 | generated_others += custom_target( |
| 236 | '$1__markdown'.underscorify(), |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 237 | input: [ ${sources} ], |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 238 | output: [ '$(basename "$1").md' ], |
| 239 | command: [ |
| 240 | sdbuspp_gen_meson_prog, '--command', 'markdown', |
| 241 | '--output', meson.current_build_dir(), |
| 242 | '--tool', sdbusplusplus_prog, |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 243 | '--directory', meson.current_source_dir() / '${yamldir}', |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 244 | '$1', |
| 245 | ], |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 246 | ) |
| 247 | |
| 248 | EOF |
| 249 | } |
| 250 | |
| 251 | ## Handle command=meson by generating the tree of meson.build files. |
| 252 | function cmd_meson { |
| 253 | TLDs="com net org xyz" |
| 254 | yamls="" |
| 255 | |
| 256 | # Find all the YAML files in the TLD subdirectories. |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 257 | for d in ${TLDs}; do |
| 258 | dir="${rootdir}/${d}" |
| 259 | if [[ ! -d ${dir} ]]; then |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 260 | continue |
| 261 | fi |
| 262 | |
| 263 | yamls="\ |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 264 | ${yamls} \ |
| 265 | $(find "${dir}" -name '*.interface.yaml' -o -name '*.errors.yaml') \ |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 266 | " |
| 267 | done |
| 268 | |
| 269 | # Sort YAMLs |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 270 | # shellcheck disable=SC2312 |
| 271 | yamls="$(echo "${yamls}" | tr " " "\n" | sort)" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 272 | |
| 273 | # Assign the YAML files into the hash-table by interface name. |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 274 | for y in ${yamls}; do |
| 275 | rel="$(realpath "--relative-to=${rootdir}" "${y}")" |
| 276 | dir="$(dirname "${rel}")" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 277 | ext="${rel#*.}" |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 278 | base="$(basename "${rel}" ".${ext}")" |
| 279 | key="${dir}/${base}" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 280 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 281 | interfaces["${key}"]="${interfaces[${key}]} ${ext}" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 282 | done |
| 283 | |
| 284 | # Create the meson.build files. |
| 285 | meson_create_root |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 286 | # shellcheck disable=SC2312 |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 287 | sorted_ifaces="$(echo "${!interfaces[@]}" | tr " " "\n" | sort)" |
Patrick Williams | 9ede18b | 2022-03-12 07:55:36 -0600 | [diff] [blame] | 288 | for i in ${sorted_ifaces}; do |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 289 | meson_create_path "${i}" |
| 290 | meson_cpp_target "${i}" |
| 291 | meson_md_target "${i}" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 292 | done |
| 293 | } |
| 294 | |
| 295 | ## Handle command=cpp by calling sdbus++ as appropriate. |
| 296 | ## $1 - interface to generate. |
| 297 | ## |
| 298 | ## For an interface foo/bar, the outputdir is expected to be foo/bar. |
| 299 | function cmd_cpp { |
| 300 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 301 | if [[ "" == "$1" ]]; then |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 302 | show_usage |
| 303 | exit 1 |
| 304 | fi |
| 305 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 306 | if [[ ! -e "${rootdir}/$1.interface.yaml" ]] && |
| 307 | [[ ! -e "${rootdir}/$1.errors.yaml" ]]; then |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 308 | echo "Missing YAML for $1." |
| 309 | exit 1 |
| 310 | fi |
| 311 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 312 | mkdir -p "${outputdir}" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 313 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 314 | sdbusppcmd="${sdbuspp} -r ${rootdir}" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 315 | intf="${1//\//.}" |
| 316 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 317 | if [[ -e "${rootdir}/$1.interface.yaml" ]]; then |
| 318 | ${sdbusppcmd} interface server-header "${intf}" > "${outputdir}/server.hpp" |
| 319 | ${sdbusppcmd} interface server-cpp "${intf}" > "${outputdir}/server.cpp" |
| 320 | ${sdbusppcmd} interface client-header "${intf}" > "${outputdir}/client.hpp" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 321 | fi |
| 322 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 323 | if [[ -e "${rootdir}/$1.errors.yaml" ]]; then |
| 324 | ${sdbusppcmd} error exception-header "${intf}" > "${outputdir}/error.hpp" |
| 325 | ${sdbusppcmd} error exception-cpp "${intf}" > "${outputdir}/error.cpp" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 326 | fi |
| 327 | } |
| 328 | |
| 329 | ## Handle command=markdown by calling sdbus++ as appropriate. |
| 330 | ## $1 - interface to generate. |
| 331 | ## |
| 332 | ## For an interface foo/bar, the outputdir is expected to be foo. |
| 333 | function cmd_markdown { |
| 334 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 335 | if [[ "" == "$1" ]]; then |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 336 | show_usage |
| 337 | exit 1 |
| 338 | fi |
| 339 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 340 | if [[ ! -e "${rootdir}/$1.interface.yaml" ]] && |
| 341 | [[ ! -e "${rootdir}/$1.errors.yaml" ]]; then |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 342 | echo "Missing YAML for $1." |
| 343 | exit 1 |
| 344 | fi |
| 345 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 346 | mkdir -p "${outputdir}" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 347 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 348 | sdbusppcmd="${sdbuspp} -r ${rootdir}" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 349 | intf="${1//\//.}" |
| 350 | base="$(basename "$1")" |
| 351 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 352 | echo -n > "${outputdir}/${base}.md" |
| 353 | if [[ -e "${rootdir}/$1.interface.yaml" ]]; then |
| 354 | ${sdbusppcmd} interface markdown "${intf}" >> "${outputdir}/${base}.md" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 355 | fi |
| 356 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 357 | if [[ -e "${rootdir}/$1.errors.yaml" ]]; then |
| 358 | ${sdbusppcmd} error markdown "${intf}" >> "${outputdir}/${base}.md" |
Patrick Williams | 847a0c3 | 2020-06-24 15:18:10 -0500 | [diff] [blame] | 359 | fi |
| 360 | } |
| 361 | |
| 362 | ## Handle command=version. |
| 363 | function cmd_version { |
| 364 | show_version |
| 365 | } |
| 366 | |
Patrick Williams | d77548a | 2022-04-29 14:43:15 -0500 | [diff] [blame] | 367 | "cmd_${cmd}" "$*" |