Commit b53ea4c 1 parent b6208db commit b53ea4c Copy full SHA for b53ea4c
File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ def parse_args ($array ):
2
+ array |
3
+ to_entries | . [] |
4
+ if (.key == "_flags" ) then
5
+ select ((.value | type == "array" ) and (.value | length != 0 )) |
6
+ .value | map ("--" + . + " " ) | join (" " ) | @text
7
+ else
8
+ select (.value != "" ) |
9
+ if (.value | type == "array" ) then
10
+ "--" + .key + "=" + (.value | join ("," )) + " "
11
+ else
12
+ "--" + .key + "=" + (.value ) + " "
13
+ end
14
+ end
15
+ ;
16
+
17
+ def count ($array ):
18
+ array | length
19
+ ;
20
+
21
+ def select_independants ($array ):
22
+ array |
23
+ to_entries | . [] |
24
+ select ((.value == - 1 ) or (.value == "-1" )) |
25
+ .key
26
+ ;
27
+
28
+ def select_dependants ($array ):
29
+ array |
30
+ to_entries |
31
+ map (select (.value > 0 )) |
32
+ sort_by (.value ) |
33
+ . [].key
34
+ ;
You can’t perform that action at this time.
0 commit comments