Closed alexjurkiewicz closed 3 years ago
Thanks for the proposal! I'd prefer to keep the $
though.
While I agree with you that in the case you mentioned, it'd be slightly easier, we'd need to change the format across the whole README to be consistent. Then the picture becomes less clear: The $
sign in some parts of the file indicates which part is the command and which part is the expected output.
This shows off the tools functionality for newcomers but is also part of some bare-bones test-script to make sure the commands in the README actually work and continue to work.
Current
✗ cat README.md | \
sed -e 's_git@github.com:_https://github.com/_g' | \
sed -n "/\`\`\`bash testcase=${x}/,/\`\`\`/p" | \
sed -e 's/^[[:space:]]*//' | \
grep '^\$' | \
sed -e 's/^\$ //g'
go get github.com/flosell/iam-policy-json-to-terraform
echo '{"Statement":[{"Effect":"Allow","Action":["ec2:Describe*"],"Resource":"*"}]}' | iam-policy-json-to-terraform
git clone https://github.com/flosell/iam-policy-json-to-terraform.git
cd iam-policy-json-to-terraform
make tools
make
@flosell what if we did this in scripts/test-readme.sh
? Then we could remove the $
signs from the commands in the README.
✗ cat README.md-no-money | \
sed -e 's_git@github.com:_https://github.com/_g' | \
sed -n "/\`\`\`bash testcase=${x}/,/\`\`\`/p" | \
sed -e 's/^[[:space:]]*//' | \
grep 'testcase=' -A1 | \
egrep -v 'testcase=|^--' | \
sed -e 's/^\$ //g'
go get github.com/flosell/iam-policy-json-to-terraform
echo '{"Statement":[{"Effect":"Allow","Action":["ec2:Describe*"],"Resource":"*"}]}' | iam-policy-json-to-terraform
git clone https://github.com/flosell/iam-policy-json-to-terraform.git
cd iam-policy-json-to-terraform
make
Note the contents of README.md-no-money
has every command's $
removed except for the last $ make
command which shows the output.
Now you can copy the entire line and paste it into your terminal.