Skip to content

Commit fd4f50b

Browse files
chore: rename lang_bash => lang_sh & add ShellCheck config
Signed-off-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
1 parent 22ac8ff commit fd4f50b

File tree

9 files changed

+855
-22
lines changed

9 files changed

+855
-22
lines changed

.shellcheckrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
shell=sh
2+
3+
enable=all
4+
color=auto
5+
severity=style
6+
disable=SC2312
7+
external-sources=true
8+
check-sourced=true
9+
source-path=SCRIPTDIR
10+
wiki-link-count=5

.vscode/settings.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
{
2-
"shellcheck.useWorkspaceRootAsCwd": false,
3-
"shellcheck.exclude": [
4-
"2310",
5-
"2312"
6-
],
7-
"shellcheck.run": "onSave",
82
"shellcheck.customArgs": [
9-
"--severity=style",
10-
"--extended-analysis=true",
11-
"--source-path=SCRIPTDIR",
12-
"--external-sources",
13-
"--color=auto"
3+
"--rcfile=.shellcheckrc"
144
]
155
}

cspell.config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ ignoreWords:
2525
- trixie
2626

2727
# multiple words written as one
28+
- cooldown
2829
- devcontainers
2930
- libbash

src/lang-bash/install.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.
File renamed without changes.
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22
// cSpell: ignore timonwong
33
{
44
"id": "lang-bash",
5-
"version": "0.1.1",
5+
"version": "0.2.0",
66
"name": "Programming Language | Bash",
77
"documentationURL": "https://github.com/georglauterbach/dev-container-features/tree/main/src/lang-bash",
88
"description": "Work efficiently and effortlessly with Bash",
9+
"options": {
10+
"copy-libbash": {
11+
"description": "whether to copy [`libbash`](https://github.com/georglauterbach/libbash) v9.0.0 to `/usr/local/lib/`",
12+
"type": "boolean",
13+
"default": true
14+
}
15+
},
916
"customizations": {
1017
"vscode": {
1118
"extensions": [
@@ -20,18 +27,14 @@
2027
"shellcheck.useWorkspaceRootAsCwd": false,
2128
// disable needlessly aggressive lints
2229
"shellcheck.exclude": [
23-
"2310" // functions invoked in `if` with `set -e`
30+
"2310", // functions invoked in `if` with `set -e`
31+
"2312" // invoke command separately to avoid masking return values
2432
],
2533
// run ShellCheck when the editor is saved
2634
"shellcheck.run": "onSave",
2735
// supply custom arguments to make the most use of ShellCheck
2836
"shellcheck.customArgs": [
29-
"--shell=bash",
30-
"--severity=style",
31-
"--extended-analysis=true",
32-
"--source-path=SCRIPTDIR",
33-
"--external-sources",
34-
"--color=auto"
37+
"--rcfile=/usr/local/share/dev_containers/features/ghcr_io/georglauterbach/lang_bash/shellcheck.conf"
3538
]
3639
}
3740
}

src/lang-sh/install.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#! /bin/sh
2+
3+
set -e -u
4+
5+
FEATURE_SHARE_DIR=/usr/local/share/dev_containers/features/ghcr_io/georglauterbach/lang_bash
6+
readonly FEATURE_SHARE_DIR
7+
8+
parse_dev_container_options() {
9+
log 'info' 'Parsing input from options'
10+
11+
readonly COPY_LIBBASH="${COPY_LIBBASH:?COPY_LIBBASH not set or null}"
12+
}
13+
14+
main() {
15+
parse_dev_container_options
16+
17+
cp shellcheck.conf "${FEATURE_SHARE_DIR}"
18+
19+
if "${COPY_LIBBASH}"; then
20+
mkdir --parents /usr/local/lib
21+
cp libbash "${FEATURE_SHARE_DIR}"
22+
cp libbash /usr/local/lib/
23+
fi
24+
25+
return 0
26+
}

0 commit comments

Comments
 (0)