alf 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (187) hide show
  1. data/CHANGELOG.md +89 -0
  2. data/Gemfile.lock +6 -1
  3. data/README.md +35 -21
  4. data/TODO.md +0 -5
  5. data/alf.gemspec +2 -0
  6. data/alf.noespec +6 -4
  7. data/bin/alf +9 -13
  8. data/examples/{autonum.alf → operators/autonum.alf} +0 -0
  9. data/examples/{cities.rash → operators/cities.rash} +0 -0
  10. data/examples/{clip.alf → operators/clip.alf} +0 -0
  11. data/examples/{compact.alf → operators/compact.alf} +0 -0
  12. data/examples/{database.alf → operators/database.alf} +1 -1
  13. data/examples/{defaults.alf → operators/defaults.alf} +0 -0
  14. data/examples/{extend.alf → operators/extend.alf} +0 -0
  15. data/examples/{group.alf → operators/group.alf} +0 -0
  16. data/examples/{intersect.alf → operators/intersect.alf} +0 -0
  17. data/examples/{join.alf → operators/join.alf} +0 -0
  18. data/examples/operators/matching.alf +2 -0
  19. data/examples/{minus.alf → operators/minus.alf} +0 -0
  20. data/examples/operators/not_matching.alf +2 -0
  21. data/examples/{nulls.rash → operators/nulls.rash} +0 -0
  22. data/examples/{parts.rash → operators/parts.rash} +0 -0
  23. data/examples/{project.alf → operators/project.alf} +0 -0
  24. data/examples/{pseudo-with.alf → operators/pseudo-with.alf} +0 -0
  25. data/examples/{quota.alf → operators/quota.alf} +0 -0
  26. data/examples/operators/rank.alf +4 -0
  27. data/examples/{rename.alf → operators/rename.alf} +0 -0
  28. data/examples/{restrict.alf → operators/restrict.alf} +0 -0
  29. data/examples/{schema.yaml → operators/schema.yaml} +0 -0
  30. data/examples/{sort.alf → operators/sort.alf} +0 -0
  31. data/examples/{summarize.alf → operators/summarize.alf} +0 -0
  32. data/examples/{suppliers.rash → operators/suppliers.rash} +0 -0
  33. data/examples/{supplies.rash → operators/supplies.rash} +0 -0
  34. data/examples/{ungroup.alf → operators/ungroup.alf} +0 -0
  35. data/examples/{union.alf → operators/union.alf} +0 -0
  36. data/examples/{unwrap.alf → operators/unwrap.alf} +0 -0
  37. data/examples/{wrap.alf → operators/wrap.alf} +0 -0
  38. data/lib/alf.rb +837 -62
  39. data/lib/alf/loader.rb +2 -1
  40. data/lib/alf/text.rb +160 -0
  41. data/lib/alf/version.rb +1 -1
  42. data/lib/alf/yaml.rb +24 -0
  43. data/spec/integration/__database__/group.alf +3 -0
  44. data/spec/integration/__database__/parts.rash +6 -0
  45. data/spec/integration/__database__/suppliers.rash +5 -0
  46. data/spec/integration/__database__/supplies.rash +12 -0
  47. data/spec/integration/command/alf/alf_e.cmd +1 -0
  48. data/spec/integration/command/alf/alf_e.stdout +4 -0
  49. data/spec/integration/command/alf/alf_env.cmd +1 -0
  50. data/spec/integration/command/alf/alf_env.stdout +5 -0
  51. data/spec/integration/command/alf/alf_implicit.alf +1 -0
  52. data/spec/integration/command/alf/alf_implicit_exec.cmd +1 -0
  53. data/spec/integration/command/alf/alf_implicit_exec.stdout +4 -0
  54. data/spec/integration/command/alf/alf_r.cmd +1 -0
  55. data/spec/integration/command/alf/alf_r.stdout +5 -0
  56. data/spec/integration/command/alf/alf_version.cmd +1 -0
  57. data/spec/integration/command/alf/alf_version.stdout +2 -0
  58. data/spec/integration/command/alf/alf_yaml.cmd +1 -0
  59. data/spec/integration/command/alf/alf_yaml.stdout +22 -0
  60. data/spec/integration/command/alf/rel.rash +1 -0
  61. data/spec/integration/command/autonum/autonum_0.cmd +1 -0
  62. data/spec/integration/command/autonum/autonum_0.stdout +9 -0
  63. data/spec/integration/command/autonum/autonum_1.cmd +1 -0
  64. data/spec/integration/command/autonum/autonum_1.stdout +9 -0
  65. data/spec/integration/command/clip/clip_0.cmd +1 -0
  66. data/spec/integration/command/clip/clip_0.stdout +9 -0
  67. data/spec/integration/command/clip/clip_1.cmd +1 -0
  68. data/spec/integration/command/clip/clip_1.stdout +9 -0
  69. data/spec/integration/command/compact/compact_0.cmd +1 -0
  70. data/spec/integration/command/compact/compact_0.stdout +9 -0
  71. data/spec/integration/command/defaults/defaults_0.cmd +1 -0
  72. data/spec/integration/command/defaults/defaults_0.stdout +9 -0
  73. data/spec/integration/command/defaults/defaults_1.cmd +1 -0
  74. data/spec/integration/command/defaults/defaults_1.stdout +9 -0
  75. data/spec/integration/command/extend/extend_0.cmd +1 -0
  76. data/spec/integration/command/extend/extend_0.stdout +16 -0
  77. data/spec/integration/command/group/group_0.cmd +1 -0
  78. data/spec/integration/command/group/group_0.stdout +32 -0
  79. data/spec/integration/command/group/group_1.cmd +1 -0
  80. data/spec/integration/command/group/group_1.stdout +32 -0
  81. data/spec/integration/command/intersect/intersect_0.cmd +1 -0
  82. data/spec/integration/command/intersect/intersect_0.stdout +9 -0
  83. data/spec/integration/command/join/join_0.cmd +1 -0
  84. data/spec/integration/command/join/join_0.stdout +16 -0
  85. data/spec/integration/command/matching/matching_0.cmd +1 -0
  86. data/spec/integration/command/matching/matching_0.stdout +8 -0
  87. data/spec/integration/command/minus/minus_0.cmd +1 -0
  88. data/spec/integration/command/minus/minus_0.stdout +4 -0
  89. data/spec/integration/command/not-matching/not-matching_0.cmd +1 -0
  90. data/spec/integration/command/not-matching/not-matching_0.stdout +5 -0
  91. data/spec/integration/command/project/project_0.cmd +1 -0
  92. data/spec/integration/command/project/project_0.stdout +9 -0
  93. data/spec/integration/command/project/project_1.cmd +1 -0
  94. data/spec/integration/command/project/project_1.stdout +9 -0
  95. data/spec/integration/command/quota/quota_0.cmd +1 -0
  96. data/spec/integration/command/quota/quota_0.stdout +16 -0
  97. data/spec/integration/command/rank/rank_1.cmd +1 -0
  98. data/spec/integration/command/rank/rank_1.stdout +10 -0
  99. data/spec/integration/command/rank/rank_2.cmd +1 -0
  100. data/spec/integration/command/rank/rank_2.stdout +10 -0
  101. data/spec/integration/command/rank/rank_3.cmd +1 -0
  102. data/spec/integration/command/rank/rank_3.stdout +10 -0
  103. data/spec/integration/command/rank/rank_4.cmd +1 -0
  104. data/spec/integration/command/rank/rank_4.stdout +6 -0
  105. data/spec/integration/command/rank/rank_5.cmd +1 -0
  106. data/spec/integration/command/rank/rank_5.stdout +6 -0
  107. data/spec/integration/command/rename/rename_0.cmd +1 -0
  108. data/spec/integration/command/rename/rename_0.stdout +9 -0
  109. data/spec/integration/command/restrict/restrict_0.cmd +1 -0
  110. data/spec/integration/command/restrict/restrict_0.stdout +6 -0
  111. data/spec/integration/command/restrict/restrict_1.cmd +1 -0
  112. data/spec/integration/command/restrict/restrict_1.stdout +6 -0
  113. data/spec/integration/command/show/show_base.cmd +1 -0
  114. data/spec/integration/command/show/show_base.stdout +9 -0
  115. data/spec/integration/command/show/show_conflictual.cmd +1 -0
  116. data/spec/integration/command/show/show_conflictual.stdout +5 -0
  117. data/spec/integration/command/show/show_rash.cmd +1 -0
  118. data/spec/integration/command/show/show_rash.stdout +5 -0
  119. data/spec/integration/command/show/show_rash_2.cmd +1 -0
  120. data/spec/integration/command/show/show_rash_2.stdout +5 -0
  121. data/spec/integration/command/show/show_yaml.cmd +1 -0
  122. data/spec/integration/command/show/show_yaml.stdout +22 -0
  123. data/spec/integration/command/sort/sort_0.cmd +1 -0
  124. data/spec/integration/command/sort/sort_0.stdout +9 -0
  125. data/spec/integration/command/sort/sort_1.cmd +1 -0
  126. data/spec/integration/command/sort/sort_1.stdout +9 -0
  127. data/spec/integration/command/summarize/summarize_0.cmd +1 -0
  128. data/spec/integration/command/summarize/summarize_0.stdout +8 -0
  129. data/spec/integration/command/ungroup/ungroup_0.cmd +1 -0
  130. data/spec/integration/command/ungroup/ungroup_0.stdout +16 -0
  131. data/spec/integration/command/union/union_0.cmd +1 -0
  132. data/spec/integration/command/union/union_0.stdout +9 -0
  133. data/spec/integration/command/unwrap/unwrap_0.cmd +1 -0
  134. data/spec/integration/command/unwrap/unwrap_0.stdout +9 -0
  135. data/spec/integration/command/wrap/wrap_0.cmd +1 -0
  136. data/spec/integration/command/wrap/wrap_0.stdout +9 -0
  137. data/spec/integration/semantics/test_join.alf +9 -0
  138. data/spec/integration/{src → semantics}/test_minus.alf +0 -0
  139. data/spec/integration/{src → semantics}/test_project.alf +0 -0
  140. data/spec/integration/semantics/test_rank.alf +34 -0
  141. data/spec/integration/test_command.rb +36 -0
  142. data/spec/integration/test_examples.rb +11 -22
  143. data/spec/integration/test_semantics.rb +40 -0
  144. data/spec/regression/alf_file/__FILE__.alf +2 -0
  145. data/spec/regression/alf_file/suppliers.rash +5 -0
  146. data/spec/regression/alf_file/test___FILE__.rb +17 -0
  147. data/spec/regression/heading/test_heading_with_date.rb +12 -0
  148. data/spec/regression/lispy/test_compile.rb +14 -0
  149. data/spec/regression/relation/test_relation_with_date.rb +12 -0
  150. data/spec/regression/restrict/test_restrict_with_keywords.rb +17 -0
  151. data/spec/shared/a_value.rb +12 -0
  152. data/spec/shared/an_operator_class.rb +35 -0
  153. data/spec/spec_helper.rb +12 -34
  154. data/spec/unit/assumptions/test_file.rb +17 -0
  155. data/spec/unit/{test_assumptions.rb → assumptions/test_instance_eval.rb} +1 -1
  156. data/spec/unit/assumptions/test_scoping.rb +29 -0
  157. data/spec/unit/environment/test_folder.rb +6 -1
  158. data/spec/unit/operator/relational/matching/test_hash_based.rb +60 -0
  159. data/spec/unit/operator/relational/not_matching/test_hash_based.rb +37 -0
  160. data/spec/unit/operator/relational/test_rank.rb +50 -0
  161. data/spec/unit/operator/test_relational.rb +3 -0
  162. data/spec/unit/reader/test_alf_file.rb +7 -4
  163. data/spec/unit/reader/test_initialize.rb +60 -0
  164. data/spec/unit/relation/test_relops.rb +4 -0
  165. data/spec/unit/relation/test_to_a.rb +41 -0
  166. data/spec/unit/renderer/test_initialize.rb +60 -0
  167. data/spec/unit/test_environment.rb +38 -0
  168. data/spec/unit/test_heading.rb +38 -0
  169. data/spec/unit/test_reader.rb +5 -0
  170. data/spec/unit/test_relation.rb +31 -1
  171. data/spec/unit/test_renderer.rb +1 -1
  172. data/spec/unit/{renderer/text → text}/test_cell.rb +1 -1
  173. data/spec/unit/{renderer/text → text}/test_row.rb +1 -1
  174. data/spec/unit/{renderer/text → text}/test_table.rb +1 -1
  175. data/spec/unit/tools/test_ordering_key.rb +13 -0
  176. data/spec/unit/tools/test_parse_commandline_args.rb +47 -0
  177. data/spec/unit/tools/test_tuple_handle.rb +34 -2
  178. data/spec/unit/tools/test_varargs.rb +16 -0
  179. data/tasks/{spec_test.rake → integration_test.rake} +4 -32
  180. data/tasks/regression_test.rake +52 -0
  181. data/tasks/unit_test.rake +33 -58
  182. metadata +326 -66
  183. data/examples/runall.sh +0 -26
  184. data/lib/alf/relation.rb +0 -118
  185. data/lib/alf/renderer/text.rb +0 -153
  186. data/lib/alf/renderer/yaml.rb +0 -22
  187. data/spec/integration/test_alf_specs.rb +0 -37
@@ -0,0 +1,32 @@
1
+ +------+-----------------+
2
+ | :sid | :supplying |
3
+ +------+-----------------+
4
+ | S1 | +------+------+ |
5
+ | | | :pid | :qty | |
6
+ | | +------+------+ |
7
+ | | | P1 | 300 | |
8
+ | | | P2 | 200 | |
9
+ | | | P3 | 400 | |
10
+ | | | P4 | 200 | |
11
+ | | | P5 | 100 | |
12
+ | | | P6 | 100 | |
13
+ | | +------+------+ |
14
+ | S2 | +------+------+ |
15
+ | | | :pid | :qty | |
16
+ | | +------+------+ |
17
+ | | | P1 | 300 | |
18
+ | | | P2 | 400 | |
19
+ | | +------+------+ |
20
+ | S3 | +------+------+ |
21
+ | | | :pid | :qty | |
22
+ | | +------+------+ |
23
+ | | | P2 | 200 | |
24
+ | | +------+------+ |
25
+ | S4 | +------+------+ |
26
+ | | | :pid | :qty | |
27
+ | | +------+------+ |
28
+ | | | P2 | 200 | |
29
+ | | | P4 | 300 | |
30
+ | | | P5 | 400 | |
31
+ | | +------+------+ |
32
+ +------+-----------------+
@@ -0,0 +1 @@
1
+ alf --text group --allbut supplies -- sid supplying
@@ -0,0 +1,32 @@
1
+ +------+-----------------+
2
+ | :sid | :supplying |
3
+ +------+-----------------+
4
+ | S1 | +------+------+ |
5
+ | | | :pid | :qty | |
6
+ | | +------+------+ |
7
+ | | | P1 | 300 | |
8
+ | | | P2 | 200 | |
9
+ | | | P3 | 400 | |
10
+ | | | P4 | 200 | |
11
+ | | | P5 | 100 | |
12
+ | | | P6 | 100 | |
13
+ | | +------+------+ |
14
+ | S2 | +------+------+ |
15
+ | | | :pid | :qty | |
16
+ | | +------+------+ |
17
+ | | | P1 | 300 | |
18
+ | | | P2 | 400 | |
19
+ | | +------+------+ |
20
+ | S3 | +------+------+ |
21
+ | | | :pid | :qty | |
22
+ | | +------+------+ |
23
+ | | | P2 | 200 | |
24
+ | | +------+------+ |
25
+ | S4 | +------+------+ |
26
+ | | | :pid | :qty | |
27
+ | | +------+------+ |
28
+ | | | P2 | 200 | |
29
+ | | | P4 | 300 | |
30
+ | | | P5 | 400 | |
31
+ | | +------+------+ |
32
+ +------+-----------------+
@@ -0,0 +1 @@
1
+ alf --text intersect suppliers suppliers
@@ -0,0 +1,9 @@
1
+ +------+-------+---------+--------+
2
+ | :sid | :name | :status | :city |
3
+ +------+-------+---------+--------+
4
+ | S1 | Smith | 20 | London |
5
+ | S2 | Jones | 10 | Paris |
6
+ | S3 | Blake | 30 | Paris |
7
+ | S4 | Clark | 20 | London |
8
+ | S5 | Adams | 30 | Athens |
9
+ +------+-------+---------+--------+
@@ -0,0 +1 @@
1
+ alf --text join suppliers supplies
@@ -0,0 +1,16 @@
1
+ +------+-------+---------+--------+------+------+
2
+ | :sid | :name | :status | :city | :pid | :qty |
3
+ +------+-------+---------+--------+------+------+
4
+ | S1 | Smith | 20 | London | P1 | 300 |
5
+ | S1 | Smith | 20 | London | P2 | 200 |
6
+ | S1 | Smith | 20 | London | P3 | 400 |
7
+ | S1 | Smith | 20 | London | P4 | 200 |
8
+ | S1 | Smith | 20 | London | P5 | 100 |
9
+ | S1 | Smith | 20 | London | P6 | 100 |
10
+ | S2 | Jones | 10 | Paris | P1 | 300 |
11
+ | S2 | Jones | 10 | Paris | P2 | 400 |
12
+ | S3 | Blake | 30 | Paris | P2 | 200 |
13
+ | S4 | Clark | 20 | London | P2 | 200 |
14
+ | S4 | Clark | 20 | London | P4 | 300 |
15
+ | S4 | Clark | 20 | London | P5 | 400 |
16
+ +------+-------+---------+--------+------+------+
@@ -0,0 +1 @@
1
+ alf --text matching suppliers supplies
@@ -0,0 +1,8 @@
1
+ +------+-------+---------+--------+
2
+ | :sid | :name | :status | :city |
3
+ +------+-------+---------+--------+
4
+ | S1 | Smith | 20 | London |
5
+ | S2 | Jones | 10 | Paris |
6
+ | S3 | Blake | 30 | Paris |
7
+ | S4 | Clark | 20 | London |
8
+ +------+-------+---------+--------+
@@ -0,0 +1 @@
1
+ alf --text minus suppliers suppliers
@@ -0,0 +1,4 @@
1
+ +--+
2
+ | |
3
+ +--+
4
+ +--+
@@ -0,0 +1 @@
1
+ alf --text not-matching suppliers supplies
@@ -0,0 +1,5 @@
1
+ +------+-------+---------+--------+
2
+ | :sid | :name | :status | :city |
3
+ +------+-------+---------+--------+
4
+ | S5 | Adams | 30 | Athens |
5
+ +------+-------+---------+--------+
@@ -0,0 +1 @@
1
+ alf --text project suppliers -- name city
@@ -0,0 +1,9 @@
1
+ +-------+--------+
2
+ | :name | :city |
3
+ +-------+--------+
4
+ | Smith | London |
5
+ | Jones | Paris |
6
+ | Blake | Paris |
7
+ | Clark | London |
8
+ | Adams | Athens |
9
+ +-------+--------+
@@ -0,0 +1 @@
1
+ alf --text project --allbut suppliers -- name city
@@ -0,0 +1,9 @@
1
+ +------+---------+
2
+ | :sid | :status |
3
+ +------+---------+
4
+ | S1 | 20 |
5
+ | S2 | 10 |
6
+ | S3 | 30 |
7
+ | S4 | 20 |
8
+ | S5 | 30 |
9
+ +------+---------+
@@ -0,0 +1 @@
1
+ alf --text quota supplies -- --by=sid --order=qty position count sum_qty "sum(:qty)"
@@ -0,0 +1,16 @@
1
+ +------+------+------+-----------+----------+
2
+ | :sid | :pid | :qty | :position | :sum_qty |
3
+ +------+------+------+-----------+----------+
4
+ | S1 | P6 | 100 | 1 | 100 |
5
+ | S1 | P5 | 100 | 2 | 200 |
6
+ | S1 | P2 | 200 | 3 | 400 |
7
+ | S1 | P4 | 200 | 4 | 600 |
8
+ | S1 | P1 | 300 | 5 | 900 |
9
+ | S1 | P3 | 400 | 6 | 1300 |
10
+ | S2 | P1 | 300 | 1 | 300 |
11
+ | S2 | P2 | 400 | 2 | 700 |
12
+ | S3 | P2 | 200 | 1 | 200 |
13
+ | S4 | P2 | 200 | 1 | 200 |
14
+ | S4 | P4 | 300 | 2 | 500 |
15
+ | S4 | P5 | 400 | 3 | 900 |
16
+ +------+------+------+-----------+----------+
@@ -0,0 +1 @@
1
+ alf --text rank parts --order=weight
@@ -0,0 +1,10 @@
1
+ +------+-------+--------+------------+--------+-------+
2
+ | :pid | :name | :color | :weight | :city | :rank |
3
+ +------+-------+--------+------------+--------+-------+
4
+ | P1 | Nut | Red | 12.0000000 | London | 0 |
5
+ | P5 | Cam | Blue | 12.0000000 | Paris | 0 |
6
+ | P4 | Screw | Red | 14.0000000 | London | 2 |
7
+ | P2 | Bolt | Green | 17.0000000 | Paris | 3 |
8
+ | P3 | Screw | Blue | 17.0000000 | Oslo | 3 |
9
+ | P6 | Cog | Red | 19.0000000 | London | 5 |
10
+ +------+-------+--------+------------+--------+-------+
@@ -0,0 +1 @@
1
+ alf --text rank parts --order=weight -- pos
@@ -0,0 +1,10 @@
1
+ +------+-------+--------+------------+--------+------+
2
+ | :pid | :name | :color | :weight | :city | :pos |
3
+ +------+-------+--------+------------+--------+------+
4
+ | P1 | Nut | Red | 12.0000000 | London | 0 |
5
+ | P5 | Cam | Blue | 12.0000000 | Paris | 0 |
6
+ | P4 | Screw | Red | 14.0000000 | London | 2 |
7
+ | P2 | Bolt | Green | 17.0000000 | Paris | 3 |
8
+ | P3 | Screw | Blue | 17.0000000 | Oslo | 3 |
9
+ | P6 | Cog | Red | 19.0000000 | London | 5 |
10
+ +------+-------+--------+------------+--------+------+
@@ -0,0 +1 @@
1
+ alf --text rank parts --order=weight,pid
@@ -0,0 +1,10 @@
1
+ +------+-------+--------+------------+--------+-------+
2
+ | :pid | :name | :color | :weight | :city | :rank |
3
+ +------+-------+--------+------------+--------+-------+
4
+ | P1 | Nut | Red | 12.0000000 | London | 0 |
5
+ | P5 | Cam | Blue | 12.0000000 | Paris | 1 |
6
+ | P4 | Screw | Red | 14.0000000 | London | 2 |
7
+ | P2 | Bolt | Green | 17.0000000 | Paris | 3 |
8
+ | P3 | Screw | Blue | 17.0000000 | Oslo | 4 |
9
+ | P6 | Cog | Red | 19.0000000 | London | 5 |
10
+ +------+-------+--------+------------+--------+-------+
@@ -0,0 +1 @@
1
+ alf rank parts --order=weight,desc -- position
@@ -0,0 +1,6 @@
1
+ {:pid => "P6", :name => "Cog", :color => "Red", :weight => 19.0, :city => "London", :position => 0}
2
+ {:pid => "P2", :name => "Bolt", :color => "Green", :weight => 17.0, :city => "Paris", :position => 1}
3
+ {:pid => "P3", :name => "Screw", :color => "Blue", :weight => 17.0, :city => "Oslo", :position => 1}
4
+ {:pid => "P4", :name => "Screw", :color => "Red", :weight => 14.0, :city => "London", :position => 3}
5
+ {:pid => "P5", :name => "Cam", :color => "Blue", :weight => 12.0, :city => "Paris", :position => 4}
6
+ {:pid => "P1", :name => "Nut", :color => "Red", :weight => 12.0, :city => "London", :position => 4}
@@ -0,0 +1 @@
1
+ alf rank parts --order=weight,desc,pid,asc -- position
@@ -0,0 +1,6 @@
1
+ {:pid => "P6", :name => "Cog", :color => "Red", :weight => 19.0, :city => "London", :position => 0}
2
+ {:pid => "P2", :name => "Bolt", :color => "Green", :weight => 17.0, :city => "Paris", :position => 1}
3
+ {:pid => "P3", :name => "Screw", :color => "Blue", :weight => 17.0, :city => "Oslo", :position => 2}
4
+ {:pid => "P4", :name => "Screw", :color => "Red", :weight => 14.0, :city => "London", :position => 3}
5
+ {:pid => "P1", :name => "Nut", :color => "Red", :weight => 12.0, :city => "London", :position => 4}
6
+ {:pid => "P5", :name => "Cam", :color => "Blue", :weight => 12.0, :city => "Paris", :position => 5}
@@ -0,0 +1 @@
1
+ alf --text rename suppliers -- name supplier_name city supplier_city
@@ -0,0 +1,9 @@
1
+ +------+----------------+---------+----------------+
2
+ | :sid | :supplier_name | :status | :supplier_city |
3
+ +------+----------------+---------+----------------+
4
+ | S1 | Smith | 20 | London |
5
+ | S2 | Jones | 10 | Paris |
6
+ | S3 | Blake | 30 | Paris |
7
+ | S4 | Clark | 20 | London |
8
+ | S5 | Adams | 30 | Athens |
9
+ +------+----------------+---------+----------------+
@@ -0,0 +1 @@
1
+ alf --text restrict suppliers -- "status > 20"
@@ -0,0 +1,6 @@
1
+ +------+-------+---------+--------+
2
+ | :sid | :name | :status | :city |
3
+ +------+-------+---------+--------+
4
+ | S3 | Blake | 30 | Paris |
5
+ | S5 | Adams | 30 | Athens |
6
+ +------+-------+---------+--------+
@@ -0,0 +1 @@
1
+ alf --text restrict suppliers -- city "'London'"
@@ -0,0 +1,6 @@
1
+ +------+-------+---------+--------+
2
+ | :sid | :name | :status | :city |
3
+ +------+-------+---------+--------+
4
+ | S1 | Smith | 20 | London |
5
+ | S4 | Clark | 20 | London |
6
+ +------+-------+---------+--------+
@@ -0,0 +1 @@
1
+ alf show suppliers
@@ -0,0 +1,9 @@
1
+ +------+-------+---------+--------+
2
+ | :sid | :name | :status | :city |
3
+ +------+-------+---------+--------+
4
+ | S1 | Smith | 20 | London |
5
+ | S2 | Jones | 10 | Paris |
6
+ | S3 | Blake | 30 | Paris |
7
+ | S4 | Clark | 20 | London |
8
+ | S5 | Adams | 30 | Athens |
9
+ +------+-------+---------+--------+
@@ -0,0 +1 @@
1
+ alf --yaml show suppliers --rash
@@ -0,0 +1,5 @@
1
+ {:sid => "S1", :name => "Smith", :status => 20, :city => "London"}
2
+ {:sid => "S2", :name => "Jones", :status => 10, :city => "Paris"}
3
+ {:sid => "S3", :name => "Blake", :status => 30, :city => "Paris"}
4
+ {:sid => "S4", :name => "Clark", :status => 20, :city => "London"}
5
+ {:sid => "S5", :name => "Adams", :status => 30, :city => "Athens"}
@@ -0,0 +1 @@
1
+ alf show suppliers --rash
@@ -0,0 +1,5 @@
1
+ {:sid => "S1", :name => "Smith", :status => 20, :city => "London"}
2
+ {:sid => "S2", :name => "Jones", :status => 10, :city => "Paris"}
3
+ {:sid => "S3", :name => "Blake", :status => 30, :city => "Paris"}
4
+ {:sid => "S4", :name => "Clark", :status => 20, :city => "London"}
5
+ {:sid => "S5", :name => "Adams", :status => 30, :city => "Athens"}
@@ -0,0 +1 @@
1
+ alf -rdate extend suppliers -- date "Date.parse('2011-07-22')"
@@ -0,0 +1,5 @@
1
+ {:sid => "S1", :name => "Smith", :status => 20, :city => "London", :date => Marshal.load("\x04\bU:\tDate[\bU:\rRational[\ai\x03\xA9\xF1Ji\ai\x00i\x03\x19\x15#")}
2
+ {:sid => "S2", :name => "Jones", :status => 10, :city => "Paris", :date => Marshal.load("\x04\bU:\tDate[\bU:\rRational[\ai\x03\xA9\xF1Ji\ai\x00i\x03\x19\x15#")}
3
+ {:sid => "S3", :name => "Blake", :status => 30, :city => "Paris", :date => Marshal.load("\x04\bU:\tDate[\bU:\rRational[\ai\x03\xA9\xF1Ji\ai\x00i\x03\x19\x15#")}
4
+ {:sid => "S4", :name => "Clark", :status => 20, :city => "London", :date => Marshal.load("\x04\bU:\tDate[\bU:\rRational[\ai\x03\xA9\xF1Ji\ai\x00i\x03\x19\x15#")}
5
+ {:sid => "S5", :name => "Adams", :status => 30, :city => "Athens", :date => Marshal.load("\x04\bU:\tDate[\bU:\rRational[\ai\x03\xA9\xF1Ji\ai\x00i\x03\x19\x15#")}
@@ -0,0 +1 @@
1
+ alf show suppliers --yaml
@@ -0,0 +1,22 @@
1
+ ---
2
+ - :sid: S1
3
+ :name: Smith
4
+ :status: 20
5
+ :city: London
6
+ - :sid: S2
7
+ :name: Jones
8
+ :status: 10
9
+ :city: Paris
10
+ - :sid: S3
11
+ :name: Blake
12
+ :status: 30
13
+ :city: Paris
14
+ - :sid: S4
15
+ :name: Clark
16
+ :status: 20
17
+ :city: London
18
+ - :sid: S5
19
+ :name: Adams
20
+ :status: 30
21
+ :city: Athens
22
+
@@ -0,0 +1 @@
1
+ alf --text sort suppliers -- name asc
@@ -0,0 +1,9 @@
1
+ +------+-------+---------+--------+
2
+ | :sid | :name | :status | :city |
3
+ +------+-------+---------+--------+
4
+ | S5 | Adams | 30 | Athens |
5
+ | S3 | Blake | 30 | Paris |
6
+ | S4 | Clark | 20 | London |
7
+ | S2 | Jones | 10 | Paris |
8
+ | S1 | Smith | 20 | London |
9
+ +------+-------+---------+--------+
@@ -0,0 +1 @@
1
+ alf --text sort suppliers -- city desc name asc
@@ -0,0 +1,9 @@
1
+ +------+-------+---------+--------+
2
+ | :sid | :name | :status | :city |
3
+ +------+-------+---------+--------+
4
+ | S3 | Blake | 30 | Paris |
5
+ | S2 | Jones | 10 | Paris |
6
+ | S4 | Clark | 20 | London |
7
+ | S1 | Smith | 20 | London |
8
+ | S5 | Adams | 30 | Athens |
9
+ +------+-------+---------+--------+
@@ -0,0 +1 @@
1
+ alf --text summarize supplies -- --by=sid total_qty "sum(:qty)"
@@ -0,0 +1,8 @@
1
+ +------+------------+
2
+ | :sid | :total_qty |
3
+ +------+------------+
4
+ | S1 | 1300 |
5
+ | S2 | 700 |
6
+ | S3 | 200 |
7
+ | S4 | 900 |
8
+ +------+------------+
@@ -0,0 +1 @@
1
+ alf --text ungroup group -- supplying
@@ -0,0 +1,16 @@
1
+ +------+------+------+
2
+ | :sid | :pid | :qty |
3
+ +------+------+------+
4
+ | S1 | P1 | 300 |
5
+ | S1 | P2 | 200 |
6
+ | S1 | P3 | 400 |
7
+ | S1 | P4 | 200 |
8
+ | S1 | P5 | 100 |
9
+ | S1 | P6 | 100 |
10
+ | S2 | P1 | 300 |
11
+ | S2 | P2 | 400 |
12
+ | S3 | P2 | 200 |
13
+ | S4 | P2 | 200 |
14
+ | S4 | P4 | 300 |
15
+ | S4 | P5 | 400 |
16
+ +------+------+------+
@@ -0,0 +1 @@
1
+ alf --text union suppliers suppliers
@@ -0,0 +1,9 @@
1
+ +------+-------+---------+--------+
2
+ | :sid | :name | :status | :city |
3
+ +------+-------+---------+--------+
4
+ | S1 | Smith | 20 | London |
5
+ | S2 | Jones | 10 | Paris |
6
+ | S3 | Blake | 30 | Paris |
7
+ | S4 | Clark | 20 | London |
8
+ | S5 | Adams | 30 | Athens |
9
+ +------+-------+---------+--------+