Skip to content
Myr

update-help.awk

This file

Path

scripts/update-help.awk

41 lines · 618 bytes

Last changed by

Merge pull request #1905 from tmccombs/release-automationThayne McCombsbefore adoptionfb1486f

History of this file

Take it

1#!/usr/bin/gawk -f23BEGIN {4  inSection = 05  inBlock = 06}789/Command-line options/ { inSection=1 }1011inSection && /^```/ {12  inBlock=113  inSection=014  # print the starting fence then move to next line15  print16  next17}1819inBlock && /^```/ {20  cmd="cargo run --release --quiet -- -h"21  # Output the results of fd -h22  u=023  while (cmd | getline line) {24    # Skip everything before the usage line25    if (line ~ /^Usage/) {26      u=1;27    }28    if (u) {29      print line30    }31  }32  status = close(cmd)33  if (status) {34    print "failed to generate help output" > "/dev/stderr"35    exit 136  }37  inBlock = 038}3940!inBlock41