Skip to content

Instantly share code, notes, and snippets.

@raspi
Created September 27, 2018 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raspi/112c58b5c07d50c605dd5a1b96b4986a to your computer and use it in GitHub Desktop.
Save raspi/112c58b5c07d50c605dd5a1b96b4986a to your computer and use it in GitHub Desktop.
Dump RC descriptions as markdown
#!/bin/sh
VARIABLES=$(sysrc -NA)
for item in $VARIABLES
do
DESCRIPTION=$(sysrc -d $item | perl -pe 's@^([^:]+): (.*)@$2@')
DEFAULT=$(sysrc -Dn $item)
if [ -z "$DESCRIPTION" ]; then
continue
fi
if [ -z "$DEFAULT" ]; then
DEFAULT=empty
else
DEFAULT=\`$DEFAULT\`
fi
echo "## \`$item\` (default: $DEFAULT)"
echo $DESCRIPTION
echo ""
done
@raspi
Copy link
Author

raspi commented Sep 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment