Skip to content

Commit

Permalink
Add uninstallation command
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevsaddam committed Jan 24, 2021
1 parent 6aab95e commit 2db96e2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@
*.pdf
docgen
vendor
.idea
.idea
linux_386
linux_amd64
mac_amd64
windows_386.exe
windows_amd64.exe
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Transform your postman collection to HTML/Markdown documentation
```bash
curl https://github.com/raw/thedevsaddam/docgen/v3/install.sh -o install.sh && sudo chmod +x install.sh && sudo ./install.sh
```
#### Uninstallation
```bash
curl https://github.com/raw/thedevsaddam/docgen/v3/install.sh -o uninstall.sh && sudo chmod +x uninstall.sh && sudo ./uninstall.sh
```

#### Windows
**For windows download the binary and set environment variable so that you can access the binary from terminal**
Expand Down
15 changes: 9 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
#! /bin/bash

exec_curl(){
echo "Found docgen latest version: $VERSION"
echo "Download may take few minutes depending on your internet speed"
echo "Downloading docgen to $2"
curl --connect-timeout 30 --retry-delay 5 --retry 5 -o "$2" "$1"
curl -L --silent --connect-timeout 30 --retry-delay 5 --retry 5 -o "$2" "$1"
}

OS=`uname`
ARCH=`uname -m`
VERSION=$1
URL=https://raw.githubusercontent.com/thedevsaddam/docgen-bin/master
URL=https://github.com/thedevsaddam/docgen-bin
TARGET=/usr/local/bin/docgen
MESSAGE_START="Installing docgen"
MESSAGE_END="Installation complete"

if [ "$VERSION" == "" ]; then
VERSION="latest"
LATEST_RELEASE=$(curl -L -s -H 'Accept: application/json' $URL/releases/latest)
VERSION=$(echo $LATEST_RELEASE | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
fi

if [ "$OS" == "Darwin" ]; then
exec_curl $URL/$VERSION/mac_amd64 $TARGET
exec_curl $URL/releases/download/$VERSION/mac_amd64 $TARGET
echo "$MESSAGE_START"
chmod +x $TARGET
echo "$MESSAGE_END"
docgen
elif [ "$OS" == "Linux" ]; then
if [ "$ARCH" == "x86_64" ]; then
exec_curl $URL/$VERSION/linux_amd64 $TARGET
exec_curl $URL/releases/download/$VERSION/linux_amd64 $TARGET
echo "$MESSAGE_START"
chmod +x $TARGET
echo "$MESSAGE_END"
docgen
fi

if [ "$ARCH" == "i368" ]; then
exec_curl $URL/$VERSION/linux_386 $TARGET
exec_curl $URL/releases/download/$VERSION/linux_386 $TARGET
chmod +x $TARGET
docgen
fi
Expand Down
10 changes: 10 additions & 0 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /bin/bash

TARGET=/usr/local/bin/docgen
MESSAGE_START="Removing docgen"
MESSAGE_END="Docgen removed"

echo "$MESSAGE_START"
rm $TARGET
echo "$MESSAGE_END"

0 comments on commit 2db96e2

Please sign in to comment.