22
33[[alias ]]
44
5- name = " yml2json"
6- help = " Convert yaml to json"
5+ name = " yml2json"
6+ short_help = " Convert yaml to json"
77
8- [[alias .stage ]]
9- command = " stack"
10- options = {code =" yaml.safe_load ! json.dumps" }
8+ [[alias .stage ]]
9+ command = " stack"
10+ options = {code =" yaml.safe_load ! json.dumps" }
1111
12- [[alias .test ]]
13- invocation = [" yml2json" ]
14- input = ''' {"x": 1,}
12+ [[alias .test ]]
13+ invocation = [" yml2json" ]
14+ input = ''' {"x": 1,}
1515'''
16- output = ''' {"x": 1}
16+ output = ''' {"x": 1}
1717'''
1818
1919
2020# ## Search for xpath elements with xpath
2121
2222[[alias ]]
23- name =" xpath"
24- help = " Find xml elements matching xpath query."
25- arguments = [{name =" query" , type =" str" }]
26- inject_values =[" query" ]
23+ name =" xpath"
24+ short_help = " Find xml elements matching xpath query."
25+ arguments = [{name =" query" , type =" str" }]
26+ inject_values =[" query" ]
2727
28- [[alias .stage ]]
28+ [[alias .stage ]]
2929
30- command = " stack"
31- options = {code =" x.encode() ! io.BytesIO ! lxml.etree.parse ! x.findall(query) ! map(lambda y: y, x) ! list" }
30+ command = " stack"
31+ options = {code =" x.encode() ! io.BytesIO ! lxml.etree.parse ! x.findall(query) ! map(lambda y: y, x) ! list" }
3232
33- [[alias .stage ]]
34- command =" chain"
33+ [[alias .stage ]]
34+ command =" chain"
3535
3636
37- [[alias .test ]]
38- invocation = [" xpath" , " //" , " map" , " x.text" ]
39- input = """
40- <slide type="all">
41- <title>Overview</title>
42- <item>Anything in here</item>
43- </slide>
44- """
45- output = """
37+ [[alias .test ]]
38+ invocation = [" xpath" , " //" , " map" , " x.text" ]
39+ input = '''
40+ <slide type="all">
41+ <title>Overview</title>
42+ <item>Anything in here</item>
43+ </slide>
44+ '''
45+ output = """
4646Overview
4747Anything in here
4848"""
@@ -52,98 +52,95 @@ Anything in here
5252# ## Generate json objects
5353
5454[[alias ]]
55+ name =" jo"
56+ short_help =" Make json objects"
57+ arguments =[{name =" pairs" , type =" str" }]
58+ inject_values =[" pairs" ]
5559
5660
57- name =" jo"
58- help =" Make json objects"
59- arguments =[{name =" pairs" , type =" str" }]
60- inject_values =[" pairs" ]
61-
62-
63- [[alias .stage ]]
64- command = " eval"
65- options = {code =" pairs" }
61+ [[alias .stage ]]
62+ command = " eval"
63+ options = {code =" pairs" }
6664
67- [[alias .stage ]]
68- command = " map"
69- options = {code =" shlex.split(x, posix=False)" }
65+ [[alias .stage ]]
66+ command = " map"
67+ options = {code =" shlex.split(x, posix=False)" }
7068
71- [[alias .stage ]]
72- command = " chain"
69+ [[alias .stage ]]
70+ command = " chain"
7371
74- [[alias .stage ]]
75- command = " map"
76- options = {code =" x.partition('=') ! [x[0], ast.literal_eval(re.sub(r'^(?P<value>[A-Za-z]+)$', r'\"\\ g<value>\" ', x[2]))]" }
72+ [[alias .stage ]]
73+ command = " map"
74+ options = {code =" x.partition('=') ! [x[0], ast.literal_eval(re.sub(r'^(?P<value>[A-Za-z]+)$', r'\"\\ g<value>\" ', x[2]))]" }
7775
78- [[alias .stage ]]
79- command = " apply"
80- options = {"code" =" dict" }
76+ [[alias .stage ]]
77+ command = " apply"
78+ options = {"code" =" dict" }
8179
82- [[alias .stage ]]
83- command = " map"
84- options = {code =" json.dumps" }
80+ [[alias .stage ]]
81+ command = " map"
82+ options = {code =" json.dumps" }
8583
8684
87- [[alias .test ]]
88- invocation = [" jo" , " x=1 y=2" ]
89- input = " "
90- output = " {\" x\" : 1, \" y\" : 2}\n "
85+ [[alias .test ]]
86+ invocation = [" jo" , " x=1 y=2" ]
87+ input = " "
88+ output = " {\" x\" : 1, \" y\" : 2}\n "
9189
9290
9391[[alias ]]
92+ name = " read-jsonl"
93+ short_help = " Load jsonlines into python objects"
94+ section =" Read"
9495
95- name = " read-jsonl"
96- help = " Load jsonlines into python objects"
97- section =" Read"
98-
99- [[alias .stage ]]
96+ [[alias .stage ]]
10097
101- command = " map"
98+ command = " map"
10299
103- options = {code =" json.loads" }
100+ options = {code =" json.loads" }
104101
105- [[alias .test ]]
106- invocation = [" read-jsonl" ]
107- input = """ {"name": "Alice", "age": "21"}\n {"name": "Bob", "age": "22"}\n """
108- output = """ {'name': 'Alice', 'age': '21'}\n {'name': 'Bob', 'age': '22'}\n """
102+ [[alias .test ]]
103+ invocation = [" read-jsonl" ]
104+ input = """ {"name": "Alice", "age": "21"}\n {"name": "Bob", "age": "22"}\n """
105+ output = """ {'name': 'Alice', 'age': '21'}\n {'name': 'Bob', 'age': '22'}\n """
109106
110107
111108[[alias ]]
112- name = " read-csv"
113- help = " Load csv rows into python objects"
114- inject_values =[" delimiter" , " header" ]
115- section =" Read"
109+ name = " read-csv"
110+ short_help = " Load csv rows into python objects"
111+ inject_values =[" delimiter" , " header" ]
112+ section =" Read"
116113
117- [[alias .options ]]
118- name = " --delimiter"
119- default = " ,"
120- help = " field delimiter character"
114+ [[alias .options ]]
115+ name = " --delimiter"
116+ default = " ,"
117+ help = " field delimiter character"
121118
122- [[alias .options ]]
123- name = " --header/--no-header"
124- default =true
125- help = " Treat the first row as a header?"
119+ [[alias .options ]]
120+ name = " --header/--no-header"
121+ default =true
122+ help = " Treat the first row as a header?"
126123
127- [[alias .stage ]]
128- command = " apply"
129- options = {code =" mario_addons.plugins.addons.read_csv(x, header=header)" }
124+ [[alias .stage ]]
125+ command = " apply"
126+ options = {code =" mario_addons.plugins.addons.read_csv(x, header=header)" }
130127
131- [[alias .stage ]]
132- command = " chain"
128+ [[alias .stage ]]
129+ command = " chain"
133130
134- [[alias .stage ]]
135- command = " map"
136- options = {code =" dict(x)" }
131+ [[alias .stage ]]
132+ command = " map"
133+ options = {code =" dict(x)" }
137134
138- [[alias .test ]]
139- invocation = [" read-csv" ]
140- input = """ name,age\n Alice,21\n Bob,22\n """
141- output = """ {'name': 'Alice', 'age': '21'}\n {'name': 'Bob', 'age': '22'}\n """
135+ [[alias .test ]]
136+ invocation = [" read-csv" ]
137+ input = """ name,age\n Alice,21\n Bob,22\n """
138+ output = """ {'name': 'Alice', 'age': '21'}\n {'name': 'Bob', 'age': '22'}\n """
142139
143140
144141[[alias ]]
145142name = " read-yaml"
146- help = " Read yaml document"
143+ short_help = " Read yaml document"
147144section = " Read"
148145
149146[[alias .stage ]]
@@ -157,7 +154,7 @@ output = "{'x': 1}\n"
157154
158155[[alias ]]
159156name = ' write-json'
160- help = " Write json document"
157+ short_help = " Write json document"
161158section = " Write"
162159
163160[[alias .stage ]]
@@ -170,11 +167,9 @@ input = "1 2\n"
170167output =" [[\" 1\" , \" 2\" ]]\n "
171168
172169
173-
174-
175170[[alias ]]
176171name = ' write-toml'
177- help = " Write toml document"
172+ short_help = " Write toml document"
178173section = " Write"
179174
180175[[alias .stage ]]
0 commit comments