Skip to content

Commit

Permalink
Merge pull request #15 from foomo/contentful-cli
Browse files Browse the repository at this point in the history
feat(contentful/contentful-cli): add
  • Loading branch information
franklinkim authored Oct 2, 2024
2 parents a39a789 + a3d5ab0 commit b97c848
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
11 changes: 11 additions & 0 deletions contentful/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Contentful

## contenful-cli ([releases](https://github.com/contentful/contentful-cli/releases))

```yaml
ownbrew:
packages:
- name: contentful-cli
tap: foomo/tap/foomo/contentful
version: 3.3.15
```
47 changes: 47 additions & 0 deletions contentful/contentful-cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

set -e

# colors
CRed='\033[1;31m'
CGray='\033[0;37m'
CGreen='\033[1;32m'
CYellow='\033[1;33m'
NC='\033[0m'

# logging
info() {
echo -e "${CGray}${1}${NC}"
}

warn() {
echo -e "${CYellow}${1}${NC}"
}

error() {
echo -e "${CRed}${1}${NC}"
}

success() {
echo -e "${CGreen}${1}${NC}"
}

# vars
os="${os:-${1}}"
arch="${arch:-${2}}"
version="${version:-${3}}"

case $os in
linux) os_alias="linux";;
darwin) os_alias="macos";;
esac

info "downloading ..."
curl -fL "https://github.com/contentful/contentful-cli/releases/download/v${version}/contentful-cli-${os_alias}-${version}.zip" -o "${TEMP_DIR}/contentful-cli.zip"

info "extracting ..."
unzip -p "${TEMP_DIR}/contentful-cli.zip" > "${BIN_DIR}/contentful-${version}-${os}-${arch}"
chmod a+x "${BIN_DIR}/contentful-${version}-${os}-${arch}"

info "cleanup ..."
rm "${TEMP_DIR}/contentful-cli.zip"
5 changes: 5 additions & 0 deletions contentful/contentful-cli_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

source .include/test.sh

test "$(dirname $0)/contentful-cli.sh" "3.3.15"

0 comments on commit b97c848

Please sign in to comment.