Skip to content

Commit 881b60f

Browse files
committed
fix
1 parent 46e7e19 commit 881b60f

4 files changed

Lines changed: 42 additions & 48 deletions

File tree

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* [reader](https://github.com/podhmo/kamidana/blob/master/kamidana/additionals/reader.py)
1212
* kamidana-action additonals
1313
* [color](additionals/color.py)
14+
* is_success
15+
* is_failure
1416
* (as_global) status_success_color
1517
* (as_global) status_failure_color
1618
* (as_global) status_other_color
@@ -35,9 +37,6 @@
3537
* listdir
3638
* listdir_files
3739
* listdir_dirs
38-
* [status](additionals/status.py)
39-
* is_success
40-
* is_failure
4140
* [to_yaml](additionals/to_yaml.py)
4241
* to_yaml
4342
* to_nice_yaml

additionals/color.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,44 @@
77
import os
88

99

10+
success_texts = [
11+
"success",
12+
"succeeded",
13+
"pass",
14+
"passed",
15+
"ok",
16+
]
17+
18+
failure_texts = [
19+
"failure",
20+
"failed",
21+
"fail",
22+
"error",
23+
"errored",
24+
"ng",
25+
]
26+
27+
28+
@as_filter
29+
@pass_context
30+
def is_success(ctx, v):
31+
if isinstance(v, str):
32+
return v.lower() in success_texts
33+
if v:
34+
return True
35+
return False
36+
37+
38+
@as_filter
39+
@pass_context
40+
def is_failure(ctx, v):
41+
if isinstance(v, str):
42+
return v.lower() in failure_texts
43+
if v:
44+
return True
45+
return False
46+
47+
1048
@as_global
1149
def status_success_color():
1250
return Color(os.getenv('KAMIDANA_STATUS_SUCCESS', '#1f883d'))

additionals/status.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

readme/README.md.j2

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* [reader](https://github.com/podhmo/kamidana/blob/master/kamidana/additionals/reader.py)
1212
* kamidana-action additonals
1313
* [color](additionals/color.py)
14+
* is_success
15+
* is_failure
1416
* (as_global) status_success_color
1517
* (as_global) status_failure_color
1618
* (as_global) status_other_color
@@ -35,9 +37,6 @@
3537
* listdir
3638
* listdir_files
3739
* listdir_dirs
38-
* [status](additionals/status.py)
39-
* is_success
40-
* is_failure
4140
* [to_yaml](additionals/to_yaml.py)
4241
* to_yaml
4342
* to_nice_yaml

0 commit comments

Comments
 (0)