diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 0000000..42d62c7 --- /dev/null +++ b/.devcontainer/README.md @@ -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`. diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c0a5c78..03f8679 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -26,7 +26,9 @@ }, "extensions": [ "ms-vscode.live-server", - ] + ], + # Simplify bash prompt + "postStartCommand": "grep -qxF \"export PS1='\\$ '\" ~/.bashrc || echo \"export PS1='\\$ '\" >> ~/.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.