Skip to content

fix - update hacker-news-headlines.gpt #67

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

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion examples/hacker-news-headlines.gpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,24 @@ description: starts a MongoDB database

#!/usr/bin/env bash

docker run --rm -d -p 27017:27017 --name mongodb mongo:latest
# The name of your container
CONTAINER_NAME=mongodb

# Check if the container already exists
if docker ps -a --format '{{.Names}}' | grep -Eq "^${CONTAINER_NAME}\$"; then
echo "Container ${CONTAINER_NAME} exists."

# Check if the container is already running
if ! docker ps --format '{{.Names}}' | grep -Eq "^${CONTAINER_NAME}\$"; then
echo "Starting existing container ${CONTAINER_NAME}."
docker start ${CONTAINER_NAME}
else
echo "Container ${CONTAINER_NAME} is already running."
fi
else
echo "Container ${CONTAINER_NAME} does not exist. Running a new one."
docker run --rm -d -p 27017:27017 --name ${CONTAINER_NAME} mongo:latest
fi

---
name: mongo_command
Expand Down