Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate markdown docs of controls by family in one click #5

Open
gregelin opened this issue Feb 20, 2019 · 1 comment
Open

Generate markdown docs of controls by family in one click #5

gregelin opened this issue Feb 20, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@gregelin
Copy link
Collaborator

Request from @openprivacy to generate markdown docs of controls in a family.

@gregelin gregelin added the enhancement New feature or request label Feb 20, 2019
@openprivacy
Copy link
Contributor

Currently using this script:

#!/usr/bin/env bash

# Generate separate files for each family of controls and a table of contents.
# Requires: https://github.com/ekalinin/github-markdown-toc v0.5+
#      and: https://github.com/GovReady/hyperGRC

# This is dependant on location of hypergrc
export PYTHONPATH=../../govready/hypergrc/

TMP=$(mktemp)

# Add '-d' option for full RMF description.
python3 -m hypergrc.ssp . > $TMP
FAMILIES=$(egrep '^## ' $TMP | cut -d' ' -f2 | cut -d: -f1)

mkdir -p docs/controls

for FAM in $FAMILIES; do
  python3 -m hypergrc.ssp -d --family $FAM . > docs/controls/${FAM}.md
done

cd docs

DATE=`date "+%Y.%m.%d at %H%M"`

echo "# LINCS Controls (compiled: ${DATE})" > controls.md

gh-md-toc controls/* | sed '/^           /d' | sed '/^   \*/d' | sed 's/^      //' | \
  sed 's/^\(Created by \[gh-md-toc\].*$\)/<!-- \1 -->/' >> controls.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants