alf 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +89 -0
- data/Gemfile.lock +6 -1
- data/README.md +35 -21
- data/TODO.md +0 -5
- data/alf.gemspec +2 -0
- data/alf.noespec +6 -4
- data/bin/alf +9 -13
- data/examples/{autonum.alf → operators/autonum.alf} +0 -0
- data/examples/{cities.rash → operators/cities.rash} +0 -0
- data/examples/{clip.alf → operators/clip.alf} +0 -0
- data/examples/{compact.alf → operators/compact.alf} +0 -0
- data/examples/{database.alf → operators/database.alf} +1 -1
- data/examples/{defaults.alf → operators/defaults.alf} +0 -0
- data/examples/{extend.alf → operators/extend.alf} +0 -0
- data/examples/{group.alf → operators/group.alf} +0 -0
- data/examples/{intersect.alf → operators/intersect.alf} +0 -0
- data/examples/{join.alf → operators/join.alf} +0 -0
- data/examples/operators/matching.alf +2 -0
- data/examples/{minus.alf → operators/minus.alf} +0 -0
- data/examples/operators/not_matching.alf +2 -0
- data/examples/{nulls.rash → operators/nulls.rash} +0 -0
- data/examples/{parts.rash → operators/parts.rash} +0 -0
- data/examples/{project.alf → operators/project.alf} +0 -0
- data/examples/{pseudo-with.alf → operators/pseudo-with.alf} +0 -0
- data/examples/{quota.alf → operators/quota.alf} +0 -0
- data/examples/operators/rank.alf +4 -0
- data/examples/{rename.alf → operators/rename.alf} +0 -0
- data/examples/{restrict.alf → operators/restrict.alf} +0 -0
- data/examples/{schema.yaml → operators/schema.yaml} +0 -0
- data/examples/{sort.alf → operators/sort.alf} +0 -0
- data/examples/{summarize.alf → operators/summarize.alf} +0 -0
- data/examples/{suppliers.rash → operators/suppliers.rash} +0 -0
- data/examples/{supplies.rash → operators/supplies.rash} +0 -0
- data/examples/{ungroup.alf → operators/ungroup.alf} +0 -0
- data/examples/{union.alf → operators/union.alf} +0 -0
- data/examples/{unwrap.alf → operators/unwrap.alf} +0 -0
- data/examples/{wrap.alf → operators/wrap.alf} +0 -0
- data/lib/alf.rb +837 -62
- data/lib/alf/loader.rb +2 -1
- data/lib/alf/text.rb +160 -0
- data/lib/alf/version.rb +1 -1
- data/lib/alf/yaml.rb +24 -0
- data/spec/integration/__database__/group.alf +3 -0
- data/spec/integration/__database__/parts.rash +6 -0
- data/spec/integration/__database__/suppliers.rash +5 -0
- data/spec/integration/__database__/supplies.rash +12 -0
- data/spec/integration/command/alf/alf_e.cmd +1 -0
- data/spec/integration/command/alf/alf_e.stdout +4 -0
- data/spec/integration/command/alf/alf_env.cmd +1 -0
- data/spec/integration/command/alf/alf_env.stdout +5 -0
- data/spec/integration/command/alf/alf_implicit.alf +1 -0
- data/spec/integration/command/alf/alf_implicit_exec.cmd +1 -0
- data/spec/integration/command/alf/alf_implicit_exec.stdout +4 -0
- data/spec/integration/command/alf/alf_r.cmd +1 -0
- data/spec/integration/command/alf/alf_r.stdout +5 -0
- data/spec/integration/command/alf/alf_version.cmd +1 -0
- data/spec/integration/command/alf/alf_version.stdout +2 -0
- data/spec/integration/command/alf/alf_yaml.cmd +1 -0
- data/spec/integration/command/alf/alf_yaml.stdout +22 -0
- data/spec/integration/command/alf/rel.rash +1 -0
- data/spec/integration/command/autonum/autonum_0.cmd +1 -0
- data/spec/integration/command/autonum/autonum_0.stdout +9 -0
- data/spec/integration/command/autonum/autonum_1.cmd +1 -0
- data/spec/integration/command/autonum/autonum_1.stdout +9 -0
- data/spec/integration/command/clip/clip_0.cmd +1 -0
- data/spec/integration/command/clip/clip_0.stdout +9 -0
- data/spec/integration/command/clip/clip_1.cmd +1 -0
- data/spec/integration/command/clip/clip_1.stdout +9 -0
- data/spec/integration/command/compact/compact_0.cmd +1 -0
- data/spec/integration/command/compact/compact_0.stdout +9 -0
- data/spec/integration/command/defaults/defaults_0.cmd +1 -0
- data/spec/integration/command/defaults/defaults_0.stdout +9 -0
- data/spec/integration/command/defaults/defaults_1.cmd +1 -0
- data/spec/integration/command/defaults/defaults_1.stdout +9 -0
- data/spec/integration/command/extend/extend_0.cmd +1 -0
- data/spec/integration/command/extend/extend_0.stdout +16 -0
- data/spec/integration/command/group/group_0.cmd +1 -0
- data/spec/integration/command/group/group_0.stdout +32 -0
- data/spec/integration/command/group/group_1.cmd +1 -0
- data/spec/integration/command/group/group_1.stdout +32 -0
- data/spec/integration/command/intersect/intersect_0.cmd +1 -0
- data/spec/integration/command/intersect/intersect_0.stdout +9 -0
- data/spec/integration/command/join/join_0.cmd +1 -0
- data/spec/integration/command/join/join_0.stdout +16 -0
- data/spec/integration/command/matching/matching_0.cmd +1 -0
- data/spec/integration/command/matching/matching_0.stdout +8 -0
- data/spec/integration/command/minus/minus_0.cmd +1 -0
- data/spec/integration/command/minus/minus_0.stdout +4 -0
- data/spec/integration/command/not-matching/not-matching_0.cmd +1 -0
- data/spec/integration/command/not-matching/not-matching_0.stdout +5 -0
- data/spec/integration/command/project/project_0.cmd +1 -0
- data/spec/integration/command/project/project_0.stdout +9 -0
- data/spec/integration/command/project/project_1.cmd +1 -0
- data/spec/integration/command/project/project_1.stdout +9 -0
- data/spec/integration/command/quota/quota_0.cmd +1 -0
- data/spec/integration/command/quota/quota_0.stdout +16 -0
- data/spec/integration/command/rank/rank_1.cmd +1 -0
- data/spec/integration/command/rank/rank_1.stdout +10 -0
- data/spec/integration/command/rank/rank_2.cmd +1 -0
- data/spec/integration/command/rank/rank_2.stdout +10 -0
- data/spec/integration/command/rank/rank_3.cmd +1 -0
- data/spec/integration/command/rank/rank_3.stdout +10 -0
- data/spec/integration/command/rank/rank_4.cmd +1 -0
- data/spec/integration/command/rank/rank_4.stdout +6 -0
- data/spec/integration/command/rank/rank_5.cmd +1 -0
- data/spec/integration/command/rank/rank_5.stdout +6 -0
- data/spec/integration/command/rename/rename_0.cmd +1 -0
- data/spec/integration/command/rename/rename_0.stdout +9 -0
- data/spec/integration/command/restrict/restrict_0.cmd +1 -0
- data/spec/integration/command/restrict/restrict_0.stdout +6 -0
- data/spec/integration/command/restrict/restrict_1.cmd +1 -0
- data/spec/integration/command/restrict/restrict_1.stdout +6 -0
- data/spec/integration/command/show/show_base.cmd +1 -0
- data/spec/integration/command/show/show_base.stdout +9 -0
- data/spec/integration/command/show/show_conflictual.cmd +1 -0
- data/spec/integration/command/show/show_conflictual.stdout +5 -0
- data/spec/integration/command/show/show_rash.cmd +1 -0
- data/spec/integration/command/show/show_rash.stdout +5 -0
- data/spec/integration/command/show/show_rash_2.cmd +1 -0
- data/spec/integration/command/show/show_rash_2.stdout +5 -0
- data/spec/integration/command/show/show_yaml.cmd +1 -0
- data/spec/integration/command/show/show_yaml.stdout +22 -0
- data/spec/integration/command/sort/sort_0.cmd +1 -0
- data/spec/integration/command/sort/sort_0.stdout +9 -0
- data/spec/integration/command/sort/sort_1.cmd +1 -0
- data/spec/integration/command/sort/sort_1.stdout +9 -0
- data/spec/integration/command/summarize/summarize_0.cmd +1 -0
- data/spec/integration/command/summarize/summarize_0.stdout +8 -0
- data/spec/integration/command/ungroup/ungroup_0.cmd +1 -0
- data/spec/integration/command/ungroup/ungroup_0.stdout +16 -0
- data/spec/integration/command/union/union_0.cmd +1 -0
- data/spec/integration/command/union/union_0.stdout +9 -0
- data/spec/integration/command/unwrap/unwrap_0.cmd +1 -0
- data/spec/integration/command/unwrap/unwrap_0.stdout +9 -0
- data/spec/integration/command/wrap/wrap_0.cmd +1 -0
- data/spec/integration/command/wrap/wrap_0.stdout +9 -0
- data/spec/integration/semantics/test_join.alf +9 -0
- data/spec/integration/{src → semantics}/test_minus.alf +0 -0
- data/spec/integration/{src → semantics}/test_project.alf +0 -0
- data/spec/integration/semantics/test_rank.alf +34 -0
- data/spec/integration/test_command.rb +36 -0
- data/spec/integration/test_examples.rb +11 -22
- data/spec/integration/test_semantics.rb +40 -0
- data/spec/regression/alf_file/__FILE__.alf +2 -0
- data/spec/regression/alf_file/suppliers.rash +5 -0
- data/spec/regression/alf_file/test___FILE__.rb +17 -0
- data/spec/regression/heading/test_heading_with_date.rb +12 -0
- data/spec/regression/lispy/test_compile.rb +14 -0
- data/spec/regression/relation/test_relation_with_date.rb +12 -0
- data/spec/regression/restrict/test_restrict_with_keywords.rb +17 -0
- data/spec/shared/a_value.rb +12 -0
- data/spec/shared/an_operator_class.rb +35 -0
- data/spec/spec_helper.rb +12 -34
- data/spec/unit/assumptions/test_file.rb +17 -0
- data/spec/unit/{test_assumptions.rb → assumptions/test_instance_eval.rb} +1 -1
- data/spec/unit/assumptions/test_scoping.rb +29 -0
- data/spec/unit/environment/test_folder.rb +6 -1
- data/spec/unit/operator/relational/matching/test_hash_based.rb +60 -0
- data/spec/unit/operator/relational/not_matching/test_hash_based.rb +37 -0
- data/spec/unit/operator/relational/test_rank.rb +50 -0
- data/spec/unit/operator/test_relational.rb +3 -0
- data/spec/unit/reader/test_alf_file.rb +7 -4
- data/spec/unit/reader/test_initialize.rb +60 -0
- data/spec/unit/relation/test_relops.rb +4 -0
- data/spec/unit/relation/test_to_a.rb +41 -0
- data/spec/unit/renderer/test_initialize.rb +60 -0
- data/spec/unit/test_environment.rb +38 -0
- data/spec/unit/test_heading.rb +38 -0
- data/spec/unit/test_reader.rb +5 -0
- data/spec/unit/test_relation.rb +31 -1
- data/spec/unit/test_renderer.rb +1 -1
- data/spec/unit/{renderer/text → text}/test_cell.rb +1 -1
- data/spec/unit/{renderer/text → text}/test_row.rb +1 -1
- data/spec/unit/{renderer/text → text}/test_table.rb +1 -1
- data/spec/unit/tools/test_ordering_key.rb +13 -0
- data/spec/unit/tools/test_parse_commandline_args.rb +47 -0
- data/spec/unit/tools/test_tuple_handle.rb +34 -2
- data/spec/unit/tools/test_varargs.rb +16 -0
- data/tasks/{spec_test.rake → integration_test.rake} +4 -32
- data/tasks/regression_test.rake +52 -0
- data/tasks/unit_test.rake +33 -58
- metadata +326 -66
- data/examples/runall.sh +0 -26
- data/lib/alf/relation.rb +0 -118
- data/lib/alf/renderer/text.rb +0 -153
- data/lib/alf/renderer/yaml.rb +0 -22
- data/spec/integration/test_alf_specs.rb +0 -37
data/lib/alf/loader.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
require "quickl"
|
1
|
+
require "quickl"
|
2
|
+
require "myrrha"
|
data/lib/alf/text.rb
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
module Alf
|
2
|
+
module Text
|
3
|
+
|
4
|
+
#
|
5
|
+
# Implements Alf::Renderer for outputting beautiful text tables.
|
6
|
+
#
|
7
|
+
class Renderer < ::Alf::Renderer
|
8
|
+
|
9
|
+
module Utils
|
10
|
+
|
11
|
+
def looks_a_relation?(value)
|
12
|
+
value.is_a?(Alf::Iterator) or
|
13
|
+
(value.is_a?(Array) && !value.empty? && value.all?{|v| v.is_a?(Hash)})
|
14
|
+
end
|
15
|
+
|
16
|
+
def max(x, y)
|
17
|
+
return y if x.nil?
|
18
|
+
return x if y.nil?
|
19
|
+
x > y ? x : y
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
include Utils
|
24
|
+
|
25
|
+
class Cell
|
26
|
+
include Utils
|
27
|
+
|
28
|
+
def initialize(value)
|
29
|
+
@value = value
|
30
|
+
end
|
31
|
+
|
32
|
+
def min_width
|
33
|
+
@min_width ||= rendering_lines.inject(0) do |maxl,line|
|
34
|
+
max(maxl,line.size)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def rendering_lines(size = nil)
|
39
|
+
if size.nil?
|
40
|
+
text_rendering.split(/\n/)
|
41
|
+
elsif @value.is_a?(Numeric)
|
42
|
+
rendering_lines(nil).collect{|l| "%#{size}s" % l}
|
43
|
+
else
|
44
|
+
rendering_lines(nil).collect{|l| "%-#{size}s" % l}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def text_rendering
|
49
|
+
@text_rendering ||= case (value = @value)
|
50
|
+
when NilClass
|
51
|
+
"[nil]"
|
52
|
+
when Symbol
|
53
|
+
value.inspect
|
54
|
+
when Float
|
55
|
+
"%.7f" % value
|
56
|
+
when Hash
|
57
|
+
value.inspect
|
58
|
+
when Alf::Iterator
|
59
|
+
Text::Renderer.render(value, "")
|
60
|
+
when Array
|
61
|
+
array_rendering(value)
|
62
|
+
else
|
63
|
+
value.to_s
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def array_rendering(value)
|
68
|
+
if looks_a_relation?(value)
|
69
|
+
Text.render(value, "")
|
70
|
+
elsif value.empty?
|
71
|
+
"[]"
|
72
|
+
else
|
73
|
+
values = value.collect{|x| Cell.new(x).text_rendering}
|
74
|
+
if values.inject(0){|memo,s| memo + s.size} < 20
|
75
|
+
"[" + values.join(", ") + "]"
|
76
|
+
else
|
77
|
+
"[" + values.join(",\n ") + "]"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end # class Cell
|
83
|
+
|
84
|
+
class Row
|
85
|
+
include Utils
|
86
|
+
|
87
|
+
def initialize(values)
|
88
|
+
@cells = values.collect{|v| Cell.new(v)}
|
89
|
+
end
|
90
|
+
|
91
|
+
def min_widths
|
92
|
+
@cells.collect{|cell| cell.min_width}
|
93
|
+
end
|
94
|
+
|
95
|
+
def rendering_lines(sizes = min_widths)
|
96
|
+
nb_lines = 0
|
97
|
+
by_cell = @cells.zip(sizes).collect do |cell,size|
|
98
|
+
lines = cell.rendering_lines(size)
|
99
|
+
nb_lines = max(nb_lines, lines.size)
|
100
|
+
lines
|
101
|
+
end
|
102
|
+
grid = (0...nb_lines).collect do |line_i|
|
103
|
+
"| " + by_cell.zip(sizes).collect{|cell_lines, size|
|
104
|
+
cell_lines[line_i] || " "*size
|
105
|
+
}.join(" | ") + " |"
|
106
|
+
end
|
107
|
+
grid.empty? ? ["| |"] : grid
|
108
|
+
end
|
109
|
+
|
110
|
+
end # class Row
|
111
|
+
|
112
|
+
class Table
|
113
|
+
include Utils
|
114
|
+
|
115
|
+
def initialize(records, attributes)
|
116
|
+
@header = Row.new(attributes)
|
117
|
+
@rows = records.collect{|r| Row.new(r)}
|
118
|
+
end
|
119
|
+
|
120
|
+
def render(buffer = "")
|
121
|
+
sizes = @rows.inject(@header.min_widths) do |memo,row|
|
122
|
+
memo.zip(row.min_widths).collect{|x,y| max(x,y)}
|
123
|
+
end
|
124
|
+
sep = '+-' << sizes.collect{|s| '-' * s}.join('-+-') << '-+'
|
125
|
+
buffer << sep << "\n"
|
126
|
+
buffer << @header.rendering_lines(sizes).first << "\n"
|
127
|
+
buffer << sep << "\n"
|
128
|
+
@rows.each do |row|
|
129
|
+
row.rendering_lines(sizes).each do |line|
|
130
|
+
buffer << line << "\n"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
buffer << sep << "\n"
|
134
|
+
buffer
|
135
|
+
end
|
136
|
+
|
137
|
+
end # class Table
|
138
|
+
|
139
|
+
protected
|
140
|
+
|
141
|
+
def render(input, output)
|
142
|
+
relation = input.to_a
|
143
|
+
attrs = relation.inject([]){|memo,t|
|
144
|
+
memo | t.keys
|
145
|
+
}
|
146
|
+
records = relation.collect{|t|
|
147
|
+
attrs.collect{|a| t[a]}
|
148
|
+
}
|
149
|
+
Table.new(records, attrs).render(output)
|
150
|
+
end
|
151
|
+
|
152
|
+
def self.render(input, output)
|
153
|
+
new(input).execute(output)
|
154
|
+
end
|
155
|
+
|
156
|
+
::Alf::Renderer.register(:text, "as a text table", self)
|
157
|
+
end # class Renderer
|
158
|
+
|
159
|
+
end # module Text
|
160
|
+
end # module Alf
|
data/lib/alf/version.rb
CHANGED
data/lib/alf/yaml.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Alf
|
2
|
+
module YAML
|
3
|
+
|
4
|
+
#
|
5
|
+
# Implements Alf::Renderer contract for outputing YAML files.
|
6
|
+
#
|
7
|
+
class Renderer < ::Alf::Renderer
|
8
|
+
|
9
|
+
protected
|
10
|
+
|
11
|
+
# (see Alf::Renderer#render)
|
12
|
+
def render(input, output)
|
13
|
+
require "yaml"
|
14
|
+
# TODO: refactor this to avoid loading all tuples
|
15
|
+
# in memory
|
16
|
+
output << input.to_a.to_yaml << "\n"
|
17
|
+
output
|
18
|
+
end
|
19
|
+
|
20
|
+
::Alf::Renderer.register(:yaml, "as a yaml output", self)
|
21
|
+
end # class Renderer
|
22
|
+
|
23
|
+
end # module YAML
|
24
|
+
end # module Alf
|
@@ -0,0 +1,6 @@
|
|
1
|
+
{:pid => 'P1', :name => 'Nut', :color => 'Red', :weight => 12.0, :city => 'London'}
|
2
|
+
{:pid => 'P2', :name => 'Bolt', :color => 'Green', :weight => 17.0, :city => 'Paris'}
|
3
|
+
{:pid => 'P3', :name => 'Screw', :color => 'Blue', :weight => 17.0, :city => 'Oslo'}
|
4
|
+
{:pid => 'P4', :name => 'Screw', :color => 'Red', :weight => 14.0, :city => 'London'}
|
5
|
+
{:pid => 'P5', :name => 'Cam', :color => 'Blue', :weight => 12.0, :city => 'Paris'}
|
6
|
+
{:pid => 'P6', :name => 'Cog', :color => 'Red', :weight => 19.0, :city => 'London'}
|
@@ -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,12 @@
|
|
1
|
+
{:sid => 'S1', :pid => 'P1', :qty => 300}
|
2
|
+
{:sid => 'S1', :pid => 'P2', :qty => 200}
|
3
|
+
{:sid => 'S1', :pid => 'P3', :qty => 400}
|
4
|
+
{:sid => 'S1', :pid => 'P4', :qty => 200}
|
5
|
+
{:sid => 'S1', :pid => 'P5', :qty => 100}
|
6
|
+
{:sid => 'S1', :pid => 'P6', :qty => 100}
|
7
|
+
{:sid => 'S2', :pid => 'P1', :qty => 300}
|
8
|
+
{:sid => 'S2', :pid => 'P2', :qty => 400}
|
9
|
+
{:sid => 'S3', :pid => 'P2', :qty => 200}
|
10
|
+
{:sid => 'S4', :pid => 'P2', :qty => 200}
|
11
|
+
{:sid => 'S4', :pid => 'P4', :qty => 300}
|
12
|
+
{:sid => 'S4', :pid => 'P5', :qty => 400}
|
@@ -0,0 +1 @@
|
|
1
|
+
alf -e "(restrict :suppliers, lambda{ status > 10})"
|
@@ -0,0 +1 @@
|
|
1
|
+
alf --env=$(_("command/alf",__FILE__)) show rel
|
@@ -0,0 +1 @@
|
|
1
|
+
(restrict :suppliers, lambda{ status > 10 })
|
@@ -0,0 +1 @@
|
|
1
|
+
alf $(_("command/alf/alf_implicit.alf",__FILE__))
|
@@ -0,0 +1 @@
|
|
1
|
+
alf -ruri extend suppliers -- uri "URI::parse(name).to_s"
|
@@ -0,0 +1,5 @@
|
|
1
|
+
{:sid => "S1", :name => "Smith", :status => 20, :city => "London", :uri => "Smith"}
|
2
|
+
{:sid => "S2", :name => "Jones", :status => 10, :city => "Paris", :uri => "Jones"}
|
3
|
+
{:sid => "S3", :name => "Blake", :status => 30, :city => "Paris", :uri => "Blake"}
|
4
|
+
{:sid => "S4", :name => "Clark", :status => 20, :city => "London", :uri => "Clark"}
|
5
|
+
{:sid => "S5", :name => "Adams", :status => 30, :city => "Athens", :uri => "Adams"}
|
@@ -0,0 +1 @@
|
|
1
|
+
alf --version
|
@@ -0,0 +1 @@
|
|
1
|
+
alf --yaml show suppliers
|
@@ -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
|
+
{:hello => "world"}
|
@@ -0,0 +1 @@
|
|
1
|
+
alf --text autonum suppliers
|
@@ -0,0 +1,9 @@
|
|
1
|
+
+------+-------+---------+--------+----------+
|
2
|
+
| :sid | :name | :status | :city | :autonum |
|
3
|
+
+------+-------+---------+--------+----------+
|
4
|
+
| S1 | Smith | 20 | London | 0 |
|
5
|
+
| S2 | Jones | 10 | Paris | 1 |
|
6
|
+
| S3 | Blake | 30 | Paris | 2 |
|
7
|
+
| S4 | Clark | 20 | London | 3 |
|
8
|
+
| S5 | Adams | 30 | Athens | 4 |
|
9
|
+
+------+-------+---------+--------+----------+
|
@@ -0,0 +1 @@
|
|
1
|
+
alf --text autonum suppliers -- unique_id
|
@@ -0,0 +1,9 @@
|
|
1
|
+
+------+-------+---------+--------+------------+
|
2
|
+
| :sid | :name | :status | :city | :unique_id |
|
3
|
+
+------+-------+---------+--------+------------+
|
4
|
+
| S1 | Smith | 20 | London | 0 |
|
5
|
+
| S2 | Jones | 10 | Paris | 1 |
|
6
|
+
| S3 | Blake | 30 | Paris | 2 |
|
7
|
+
| S4 | Clark | 20 | London | 3 |
|
8
|
+
| S5 | Adams | 30 | Athens | 4 |
|
9
|
+
+------+-------+---------+--------+------------+
|
@@ -0,0 +1 @@
|
|
1
|
+
alf --text clip suppliers -- name city
|
@@ -0,0 +1 @@
|
|
1
|
+
alf --text clip suppliers --allbut -- name city
|
@@ -0,0 +1 @@
|
|
1
|
+
alf --text compact 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 defaults suppliers -- country "'Belgium'"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
+----------+------+-------+---------+--------+
|
2
|
+
| :country | :sid | :name | :status | :city |
|
3
|
+
+----------+------+-------+---------+--------+
|
4
|
+
| Belgium | S1 | Smith | 20 | London |
|
5
|
+
| Belgium | S2 | Jones | 10 | Paris |
|
6
|
+
| Belgium | S3 | Blake | 30 | Paris |
|
7
|
+
| Belgium | S4 | Clark | 20 | London |
|
8
|
+
| Belgium | S5 | Adams | 30 | Athens |
|
9
|
+
+----------+------+-------+---------+--------+
|
@@ -0,0 +1 @@
|
|
1
|
+
alf --text defaults --strict suppliers -- country "'Belgium'"
|
@@ -0,0 +1 @@
|
|
1
|
+
alf --text extend supplies -- sp "sid + '/' + pid" big "qty > 100 ? true : false"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
+------+------+------+-------+-------+
|
2
|
+
| :sid | :pid | :qty | :sp | :big |
|
3
|
+
+------+------+------+-------+-------+
|
4
|
+
| S1 | P1 | 300 | S1/P1 | true |
|
5
|
+
| S1 | P2 | 200 | S1/P2 | true |
|
6
|
+
| S1 | P3 | 400 | S1/P3 | true |
|
7
|
+
| S1 | P4 | 200 | S1/P4 | true |
|
8
|
+
| S1 | P5 | 100 | S1/P5 | false |
|
9
|
+
| S1 | P6 | 100 | S1/P6 | false |
|
10
|
+
| S2 | P1 | 300 | S2/P1 | true |
|
11
|
+
| S2 | P2 | 400 | S2/P2 | true |
|
12
|
+
| S3 | P2 | 200 | S3/P2 | true |
|
13
|
+
| S4 | P2 | 200 | S4/P2 | true |
|
14
|
+
| S4 | P4 | 300 | S4/P4 | true |
|
15
|
+
| S4 | P5 | 400 | S4/P5 | true |
|
16
|
+
+------+------+------+-------+-------+
|
@@ -0,0 +1 @@
|
|
1
|
+
alf --text group supplies -- pid qty supplying
|