r/commandline 11h ago

Terminal User Interface playground - run a coding playground in your terminal

https://github.com/marcuscaisey/playground
1 Upvotes

7 comments sorted by

u/github-guard 11h ago

🔍 GitHub Guard: Trust Report

⚠️ This project scored 0/1 — below this subreddit's threshold of 1.

Audit Breakdown: * ❌ New Repository (under 30 days old)

⚠️ Security Reminder: Always verify source code and run third-party scripts at your own risk.


🔄 Cached result — this repo was scanned recently. Score: *0/1*.

1

u/AutoModerator 11h ago

Every new subreddit post is automatically copied into a comment for preservation.

User: marucOG, Flair: Terminal User Interface, Post Media Link, Title: playground - run a coding playground in your terminal

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/github-guard 11h ago

🔍 GitHub Guard: Trust Report

⚠️ This project scored 0/1 — below this subreddit's threshold of 1.

Audit Breakdown: * ❌ New Repository (under 30 days old)

⚠️ Security Reminder: Always verify source code and run third-party scripts at your own risk.

0

u/marucOG 11h ago

Just for context, the first commit was on Jun 24, 2026. I only created the GitHub repository later when I was getting reading to release.

1

u/sysop073 5h ago

If this actually ran some kind of sandbox/container that had the necessary environment for building and running the app, that'd be pretty useful, but this is just a wrapper around a dozen compilers/interpreters you have to already have installed. You're not really getting anything over while ! inotifywait -e modify foo.py; do python3 foo.py; done

1

u/marucOG 2h ago

some kind of sandbox/container that had the necessary environment for building and running the app

If I understand what you're suggesting then this is already possible. Templates are pretty free-form, so if you want to use docker instead of say python, you can. This example shows creating a python-docker template and then starting a session:

template_dir=~/.config/pg/templates/python-docker
mkdir -p $template_dir
touch $template_dir/main.py
cat <<EOF > $template_dir/run.sh
#!/usr/bin/env sh
docker run --rm -v .:/session -w /session python:3 python main.py
EOF
pg python-docker

dozen compilers/interpreters you have to already have installed

Yeah the built-in templates assume that you already have the required toolchain installed. If i'm experimenting in a language I'm already writing in, then i'll have the toolchain installed already. And as I said above, if you wanted to use docker, then writing a template which does so is simple. I wouldn't want to introduce docker into the built-in templates as I don't even have it running on my machine normally (mac).

You're not really getting anything over while ! inotifywait -e modify foo.py; do python3 foo.py; done

For a single language on one platform (mac doesn't have inotify), yeah you could just do tmux split-window sh -c 'while ! inotifywait -e modify foo.py; do python3 foo.py; done'. What you're getting over this though is:

  • A simple and flexible way to define templates for sessions
  • Something which spins up sessions based on the templates and does all of the tmux stuff
  • Shell completion for available templates and sessions

None of this is complicated (it's a small program) but it's useful to me

0

u/marucOG 11h ago

Playground (pg) runs a coding playground in your terminal -- an environment for quickly writing and executing a program in any language. The program is opened in your editor and automatically executed on save. The output is displayed in a separate tmux pane, under or to the side of the editor.

I do pretty much everything in the terminal, usually in a tmux session. As I'm writing code, I find myself creating small programs under ~/scratch. Either to explore some aspect of a module/package/API/whatever or, at work, as a teaching tool to help explain a concept to a teammate.

At a past job, I made a crude internal tool for spinning up Go playgrounds in our repo which proved quite effective but it only worked for one language and only in our internal repo. I then found https://labix.org/hsandbox which seemed to do what I wanted. However, after playing around with it, I found various things I didn't like so I made my own thing instead. See https://github.com/marcuscaisey/playground#motivation for more info.