Skip to content

Commit f448e83

Browse files
committed
[tutorial] tweaks to get the tutorial working on the latest version
1 parent 7b4e46b commit f448e83

File tree

6 files changed

+28
-21
lines changed

6 files changed

+28
-21
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build
2+
.git
3+
test

demo/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ RUN set -eux; \
1010
rm -rf /var/lib/{apt,dpkg,cache,log}/; \
1111
echo "Installed base utils!"
1212

13-
ADD https://github.com/tstack/lnav/releases/download/v0.11.2/lnav-0.11.2-x86_64-linux-musl.zip /
14-
RUN unzip lnav-0.11.2-x86_64-linux-musl.zip
13+
ADD https://github.com/tstack/lnav/releases/download/v0.13.0-rc1/lnav-0.13.0-rc1-linux-musl-x86_64.zip /
14+
RUN unzip lnav-0.13.0-rc1-linux-musl-x86_64.zip
1515

1616
COPY docs/tutorials tutorials
1717
RUN gunzip /tutorials/playground/logs/*.gz
@@ -25,18 +25,18 @@ RUN echo 'tutorial1:tutorial1' | chpasswd
2525
RUN passwd -d tutorial1
2626

2727
USER playground
28-
RUN /lnav-0.11.2/lnav -nN -c ":config /ui/theme monocai"
28+
RUN /lnav-0.13.0-rc1/lnav -nN -c ":config /ui/theme monocai" -c ":config /ui/mouse/mode enabled"
2929

3030
USER tutorial1
31-
RUN /lnav-0.11.2/lnav -nN -c ":config /ui/theme monocai"
31+
RUN /lnav-0.13.0-rc1/lnav -nN -c ":config /ui/theme monocai" -c ":config /ui/mouse/mode enabled"
3232

3333
USER root
3434

3535
RUN echo 'Match User playground' >> /etc/ssh/sshd_config
36-
RUN echo 'ForceCommand env PATH=/lnav-0.11.2:$PATH /tutorials/playground/run.sh' >> /etc/ssh/sshd_config
36+
RUN echo 'ForceCommand env PATH=/lnav-0.13.0-rc1:$PATH /tutorials/playground/run.sh' >> /etc/ssh/sshd_config
3737
RUN echo 'PermitEmptyPasswords yes' >> /etc/ssh/sshd_config
3838
RUN echo 'Match User tutorial1' >> /etc/ssh/sshd_config
39-
RUN echo 'ForceCommand env PATH=/lnav-0.11.2:$PATH /tutorials/tutorial1/run.sh' >> /etc/ssh/sshd_config
39+
RUN echo 'ForceCommand env PATH=/lnav-0.13.0-rc1:$PATH /tutorials/tutorial1/run.sh' >> /etc/ssh/sshd_config
4040
RUN echo 'PermitEmptyPasswords yes' >> /etc/ssh/sshd_config
4141
RUN service ssh start
4242
EXPOSE 22

docs/tutorials/tutorial-lib/formats/tutorial-lib/tutorial.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ CREATE TRIGGER IF NOT EXISTS tutorial_move_log_after_load
7676
ON lnav_events
7777
WHEN jget(new.content, '/$schema') = 'https://lnav.org/event-session-loaded-v1.schema.json'
7878
BEGIN
79-
UPDATE lnav_views SET top = 0 WHERE name = 'log';
79+
UPDATE lnav_views SET selection = 0 WHERE name = 'log';
8080
END;
8181

82-
CREATE TRIGGER IF NOT EXISTS lnav_tutorial_view_listener UPDATE OF top
82+
CREATE TRIGGER IF NOT EXISTS lnav_tutorial_view_listener UPDATE OF selection
8383
ON lnav_views_echo
8484
WHEN new.name = 'log'
8585
BEGIN
@@ -90,7 +90,7 @@ BEGIN
9090
FROM lnav_tutorial_step,
9191
lnav_tutorial_lines
9292
WHERE lnav_tutorial_step.step = lnav_tutorial_lines.step
93-
AND jget(json_object('top', new.top,
93+
AND jget(json_object('selection', new.selection,
9494
'left', new.left,
9595
'search', new.search),
9696
view_ptr) = view_value;
@@ -100,10 +100,10 @@ BEGIN
100100
lnav_tutorial_lines
101101
WHERE lnav_tutorial_step.step = lnav_tutorial_lines.step
102102
AND lnav_tutorial_lines.log_comment IS NOT NULL
103-
AND jget(json_object('top', new.top,
103+
AND jget(json_object('selection', new.selection,
104104
'left', new.left,
105105
'search', new.search), view_ptr) = view_value)
106-
WHERE log_line = new.top
106+
WHERE log_line = new.selection
107107
AND log_comment IS NULL;
108108
END;
109109

docs/tutorials/tutorial1/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: tutorial1
33
steps:
44
- move-to-error:
55
description: "Move to an error"
6-
view_ptr: /top
6+
view_ptr: /selection
77
view_value: 6
88
notification: |
99
Press `e`/`Shift+E` to move through the
@@ -19,7 +19,7 @@ steps:
1919
notification: |
2020
Press `w`/`Shift+W` to move through the
2121
<span class="-lnav_log-level-styles_warning">warnings</span>
22-
view_ptr: /top
22+
view_ptr: /selection
2323
view_value: 3
2424
comment: |
2525
You found the warning! The scrollbar on the right is highlighted
@@ -35,7 +35,7 @@ steps:
3535
move-to-next-hit:
3636
description: "Move to the next hit"
3737
notification: "Press `n`/`Shift+N` to move through the search hits"
38-
view_ptr: /top
38+
view_ptr: /selection
3939
view_value: 53
4040
comment: |
4141
The matching text in a search is highlighted in
@@ -53,7 +53,7 @@ steps:
5353
- move-to-half-hour:
5454
description: "Move to the next half-hour"
5555
notification: "Press `3`/`Shift+3` to move through the half-hour marks"
56-
view_ptr: /top
56+
view_ptr: /selection
5757
view_value: 34
5858
comment: |
5959
This file is in the _glog_ format and timestamps consist of the
@@ -65,7 +65,7 @@ steps:
6565
move-to-timestamp:
6666
description: "Move to a given timestamp"
6767
notification: "Move to '**March 23**' using `:goto` or the breadcrumb bar"
68-
view_ptr: /top
68+
view_ptr: /selection
6969
view_value: 79
7070
comment: |
7171
Many different timestamp formats are recognized as well as

src/init.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ VALUES ('org.lnav.breadcrumb.focus', -1, DATETIME('now', '+2 minute'),
188188
'Press <span class="-lnav_status-styles_hotkey">${org.lnav.key.breadcrumb.focus}</span> to focus on the breadcrumb bar');
189189

190190
CREATE TABLE lnav_views_echo AS
191-
SELECT name, top, "left", height, inner_height, top_time, search
191+
SELECT name, top, "left", height, inner_height, top_time, search, selection
192192
FROM lnav_views;
193193

194194
CREATE UNIQUE INDEX lnav_views_echo_index ON lnav_views_echo (name);

src/lnav.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,15 +1180,17 @@ looper()
11801180
height = (SELECT height FROM lnav_views WHERE lnav_views.name = lnav_views_echo.name),
11811181
inner_height = (SELECT inner_height FROM lnav_views WHERE lnav_views.name = lnav_views_echo.name),
11821182
top_time = (SELECT top_time FROM lnav_views WHERE lnav_views.name = lnav_views_echo.name),
1183-
search = (SELECT search FROM lnav_views WHERE lnav_views.name = lnav_views_echo.name)
1183+
search = (SELECT search FROM lnav_views WHERE lnav_views.name = lnav_views_echo.name),
1184+
selection = (SELECT selection FROM lnav_views WHERE lnav_views.name = lnav_views_echo.name)
11841185
WHERE EXISTS (SELECT * FROM lnav_views WHERE name = lnav_views_echo.name AND
11851186
(
11861187
lnav_views.top != lnav_views_echo.top OR
11871188
lnav_views.left != lnav_views_echo.left OR
11881189
lnav_views.height != lnav_views_echo.height OR
11891190
lnav_views.inner_height != lnav_views_echo.inner_height OR
11901191
lnav_views.top_time != lnav_views_echo.top_time OR
1191-
lnav_views.search != lnav_views_echo.search
1192+
lnav_views.search != lnav_views_echo.search OR
1193+
lnav_views.selection != lnav_views_echo.selection
11921194
))
11931195
)"
11941196
#else
@@ -1199,7 +1201,8 @@ looper()
11991201
height = orig.height,
12001202
inner_height = orig.inner_height,
12011203
top_time = orig.top_time,
1202-
search = orig.search
1204+
search = orig.search,
1205+
selection = orig.selection
12031206
FROM (SELECT * FROM lnav_views) AS orig
12041207
WHERE orig.name = lnav_views_echo.name AND
12051208
(
@@ -1208,7 +1211,8 @@ looper()
12081211
orig.height != lnav_views_echo.height OR
12091212
orig.inner_height != lnav_views_echo.inner_height OR
12101213
orig.top_time != lnav_views_echo.top_time OR
1211-
orig.search != lnav_views_echo.search
1214+
orig.search != lnav_views_echo.search OR
1215+
orig.selection != lnav_views_echo.selection
12121216
)
12131217
)"
12141218
#endif

0 commit comments

Comments
 (0)