Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 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
21 changes: 21 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Dev Container Configuration

This directory contains the configuration for GitHub Codespaces and VS Code Dev Containers.

## Shorter Terminal Prompt

The `postStartCommand` in `devcontainer.json` configures a shorter bash prompt (`\W\$ `) that shows only the current directory name instead of the full path. This makes the terminal easier to read, especially in workshop settings.

The command is idempotent—it only adds the `PS1` export line to `~/.bashrc` if it's not already present, so restarting the Codespace won't create duplicate lines.

### How to Override

If you prefer a different prompt, you can:

1. **Edit `~/.bashrc` directly**: Modify or remove the `export PS1='\W\$ '` line and add your preferred prompt setting.

2. **Use a custom dotfiles repo**: Configure your [GitHub Codespaces dotfiles](https://docs.github.com/en/codespaces/customizing-your-codespace/personalizing-github-codespaces-for-your-account#dotfiles) to set your preferred `PS1` value. Your dotfiles will take precedence.

### How to Revert

To remove this feature from the repository, delete the `postStartCommand` line from `devcontainer.json`.
4 changes: 3 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
},
"extensions": [
"ms-vscode.live-server",
]
],
// Use 'postStartCommand' to configure a shorter terminal prompt for Codespaces.
"postStartCommand": "grep -qxF \"export PS1='\\\\W\\\\$ '\" ~/.bashrc || echo \"export PS1='\\\\W\\\\$ '\" >> ~/.bashrc"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
Expand Down