Skip to content

Commit 73f07f4

Browse files
committed
add $@ to dockerll to allow passing further args
1 parent ac52f32 commit 73f07f4

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
dockerll() {
2-
docker ps -a --format "table {{ .Names }}\t{{ .Status }}\t{{ .Networks }}\t{{ .Ports }}"
2+
docker ps -a --format "table {{ .Names }}\t{{ .Status }}\t{{ .Networks }}\t{{ .Ports }}" $@
33
}

tests/docker_test.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@ function set_up() {
88
test_dockerll() {
99
local output=$(dockerll)
1010

11+
assert_greater_or_equal_than 2 "$(echo "$output" | wc -l)"
12+
13+
# output header
14+
local first_line=$(echo "$output" | head -n 1)
15+
assert_contains "NAMES " "$first_line"
16+
assert_contains " STATUS " "$first_line"
17+
assert_contains " NETWORKS " "$first_line"
18+
assert_contains " PORTS" "$first_line"
19+
}
20+
21+
test_dockerll_filtered_by_name() {
22+
local output=$(dockerll --filter name=shell-dev-tools)
23+
24+
assert_line_count 2 "$output"
25+
1126
# output header
1227
local first_line=$(echo "$output" | head -n 1)
1328
assert_contains "NAMES " "$first_line"
@@ -16,7 +31,7 @@ test_dockerll() {
1631
assert_contains " PORTS" "$first_line"
1732

1833
# output shell-dev-tools container
19-
local second_line=$(echo "$output" | sed -n '2p') # @TODO: what if it's not the 2. line?
34+
local second_line=$(echo "$output" | sed -n '2p')
2035
assert_contains "shell-dev-tools " "$second_line"
2136
assert_matches " Up [0-9]+ (seconds|minutes) " "$second_line"
2237
assert_contains " shell-dev-tools_default" "$second_line"

0 commit comments

Comments
 (0)