|
1 | | -# Lightweight, Configurable BASH Eternal History |
| 1 | +# Lightweight, Configurable BASH Config with Eternal History |
2 | 2 |
|
3 | | -## Defaults |
| 3 | +Intended as a lightweight alternative to common-utils. |
4 | 4 |
|
5 | | -When this feature is first called, onCreateCommand.sh is created and called in `devcontainer-feature`. |
6 | | -This creates and installs a default bash terminal configuration from `feature_settings_rc` which contains opinionated default BASH terminal settings such as: |
7 | | -* A minimalist, blue bash prompt. |
8 | | -* Eternal, shared history between containers using this feature. |
| 5 | +## Installation |
9 | 6 |
|
10 | | -## Customisation |
| 7 | +To use this feature in an individual devcontainer, add the following to your `.devcontainer/devcontainer.json`: |
| 8 | + |
| 9 | +```json |
| 10 | + "features": { |
| 11 | + "ghcr.io/diamondlightsource/devcontainer-features/bash-config:1": {} |
| 12 | + }, |
| 13 | + "initializeCommand": "mkdir -p ${localEnv:HOME}/.config/bash-config", |
| 14 | +``` |
| 15 | + |
| 16 | +The initializeCommand is required to create the directory for the bash-config folder in your home folder on the host, the very first time this is executed. Features do not have an InitializeCommand, so the devcontainer.json must do this. |
| 17 | + |
| 18 | +## Global Installation |
| 19 | + |
| 20 | +To use this feature in all devcontainers on your workstation, add the following to User setting.json: |
| 21 | + |
| 22 | +```json |
| 23 | + "dev.containers.defaultFeatures": { |
| 24 | + "ghcr.io/gilesknap/devcontainer-features/bash-config:1.1.0" |
| 25 | + } |
| 26 | +``` |
11 | 27 |
|
12 | | -The user can specify their own terminal preferences in `$CONFIG_STAGING/bashrc`, which defaults to `/devcontainer_staging/bashrc`. |
13 | | -Then the container is rebuilt, if `bashrc` already exists it won't be overwritten, preserving changes. If the container has been built once already, the existing bashrc must be deleted in order for your changes to be applied. |
| 28 | +Also, one time only, make sure the host folder for bash-config is created: |
14 | 29 |
|
| 30 | +```bash |
| 31 | +mkdir -p $HOME/.config/bash-config |
| 32 | +``` |
15 | 33 |
|
16 | 34 |
|
17 | | -creates staging folder in container |
18 | | -creates onCreateCommand.sh in the staging folder |
19 | | -inputrc and bashrc are also created in the staging folder, containing incremental history searching and user customisations respectively |
20 | | -feature_settings_rc is created in the staging fodler, which contains a PS1 setup and opinionated terminal features |
21 | | -"onCreateCommand" is then exectuted inside the container during finalisation of container setup. |
22 | | - - This copies the contents of feature_settings_rc into devcontainer_rc |
23 | | - - then copies bashrc and inputrc into the container, unless they exist already to prevent overwriting user edits |
24 | | - - then adds root permissions. |
25 | | -A symbolic link to /root/ is created The items in the CONFIG_FOLDER |
26 | | -our bashrc is called by /root/.bashrc |
| 35 | +## features |
| 36 | + |
| 37 | +The default, opinionated configuration can be found in `$HOME/.config/bash-config/bash-config-rc` and includes the following: |
| 38 | + |
| 39 | +- Persistent history across all devcontainers that use this feature |
| 40 | +- The MS devcontainer bash prompt with git branch and status |
| 41 | +- history search with up/down arrows (.inputrc) |
| 42 | +- ctrl-left or right arrow for word navigation (.inputrc) |
| 43 | +- git autocomplete |
| 44 | + |
| 45 | +## Customisation |
| 46 | + |
| 47 | +Can be customized by editing `$HOME/.config/bash-config/bashrc` |
0 commit comments