Skip to content

Commit 19317fd

Browse files
akbakb
authored andcommitted
Update aliases
1 parent 954cc31 commit 19317fd

File tree

1 file changed

+59
-9
lines changed

1 file changed

+59
-9
lines changed

src/mario_addons/plugins/addons.toml

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
command = "stack"
1010
options = {code="yaml.safe_load ! json.dumps"}
1111

12-
[[alias.test_spec]]
12+
[[alias.test]]
1313
invocation = ["yml2json"]
1414
input = '''{"x": 1,}
1515
'''
@@ -34,7 +34,7 @@
3434
command="chain"
3535

3636

37-
[[alias.test_spec]]
37+
[[alias.test]]
3838
invocation = ["xpath", "//", "map", "x.text"]
3939
input = """
4040
<slide type="all">
@@ -59,6 +59,7 @@ Anything in here
5959
arguments=[{name="pairs", type="str"}]
6060
inject_values=["pairs"]
6161

62+
6263
[[alias.stage]]
6364
command = "eval"
6465
options = {code="pairs"}
@@ -83,33 +84,35 @@ Anything in here
8384
options = {code="json.dumps"}
8485

8586

86-
[[alias.test_spec]]
87+
[[alias.test]]
8788
invocation = ["jo", "x=1 y=2"]
8889
input = ""
8990
output = "{\"x\": 1, \"y\": 2}\n"
9091

9192

9293
[[alias]]
9394

94-
name = "jsonl"
95+
name = "read-jsonl"
9596
help = "Load jsonlines into python objects"
97+
section ="Read"
9698

9799
[[alias.stage]]
98100

99101
command = "map"
100102

101103
options = {code="json.loads"}
102104

103-
[[alias.test_spec]]
104-
invocation = ["jsonl"]
105+
[[alias.test]]
106+
invocation = ["read-jsonl"]
105107
input = """{"name": "Alice", "age": "21"}\n{"name": "Bob", "age": "22"}\n"""
106108
output = """{'name': 'Alice', 'age': '21'}\n{'name': 'Bob', 'age': '22'}\n"""
107109

108110

109111
[[alias]]
110-
name = "csv"
112+
name = "read-csv"
111113
help = "Load csv rows into python objects"
112114
inject_values=["delimiter", "header"]
115+
section ="Read"
113116

114117
[[alias.options]]
115118
name = "--delimiter"
@@ -132,7 +135,54 @@ Anything in here
132135
command = "map"
133136
options = {code="dict(x)"}
134137

135-
[[alias.test_spec]]
136-
invocation = ["csv"]
138+
[[alias.test]]
139+
invocation = ["read-csv"]
137140
input = """name,age\nAlice,21\nBob,22\n"""
138141
output = """{'name': 'Alice', 'age': '21'}\n{'name': 'Bob', 'age': '22'}\n"""
142+
143+
144+
[[alias]]
145+
name = "read-yaml"
146+
help = "Read yaml document"
147+
section = "Read"
148+
149+
[[alias.stage]]
150+
command = "stack"
151+
options = {code="yaml.safe_load"}
152+
153+
[[alias.test]]
154+
invocation = ["read-yaml"]
155+
input = "{'x': 1,}\n"
156+
output = "{'x': 1}\n"
157+
158+
[[alias]]
159+
name = 'write-json'
160+
help = "Write json document"
161+
section = "Write"
162+
163+
[[alias.stage]]
164+
command = "apply"
165+
options={code="json.dumps"}
166+
167+
[[alias.test]]
168+
invocation = ["stack", "str.split", "write-json"]
169+
input = "1 2\n"
170+
output ="[[\"1\", \"2\"]]\n"
171+
172+
173+
174+
175+
[[alias]]
176+
name = 'write-toml'
177+
help = "Write toml document"
178+
section = "Write"
179+
180+
[[alias.stage]]
181+
command = "map"
182+
options={code="toml.dumps"}
183+
184+
[[alias.test]]
185+
invocation = ["stack", "json.loads", "write-toml"]
186+
input = '''{"x": 1}
187+
'''
188+
output = """x = 1\n"""

0 commit comments

Comments
 (0)