Skip to content

Instantly share code, notes, and snippets.

@greg0ire
Last active March 25, 2019 18:23
Show Gist options
  • Save greg0ire/a404831add1247d2bc20fa11107c5d5e to your computer and use it in GitHub Desktop.
Save greg0ire/a404831add1247d2bc20fa11107c5d5e to your computer and use it in GitHub Desktop.
How to quickly provide a markdown help test for people who want to test your PR
#!/bin/bash
#
# Assumes you are in the directory of a Composer project, on the branch of your
# PR, and that the PR is on Github
function usage()
{
echo "Usage: $1 nickname"
echo "Example: $1 greg0ire"
exit 1
}
function main()
{
cat << 'EOHEADER'
# How can I test this?
```shell
EOHEADER
cat << EOBODY
composer config repositories.$1 vcs https://github.com/$1/$(basename "$PWD")
composer require $(composer show --self --no-ansi \
|grep 'name ' \
|cut -d ':' -f 2 \
|cut -b 2-) "dev-$(git rev-parse --abbrev-ref HEAD) as $(git describe --abbrev=0 --tags)"
EOBODY
cat << 'EOFOOTER'
```
EOFOOTER
}
if [ $# -ne 1 ]
then
usage "$0"
fi
main "$1"
@greg0ire
Copy link
Author

Woops, didn't see your comment until now, fixed, thanks!

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