mirror of
https://github.com/tstack/lnav.git
synced 2024-09-11 21:07:39 +03:00
[cmds] reduce next/prev mark errors to info to make them less noisy
This commit is contained in:
parent
e90fe620c9
commit
cebc867c6b
@ -7,11 +7,12 @@ RUN set -eux; \
|
||||
apt install --yes --no-install-recommends bind9-dnsutils iputils-ping iproute2 curl ca-certificates htop wget unzip openssh-server; \
|
||||
apt clean autoclean; \
|
||||
apt autoremove --yes; \
|
||||
wget https://github.com/tstack/lnav/releases/download/v0.11.0-beta2/lnav-0.11.0-musl-64bit.zip; \
|
||||
unzip lnav-0.11.0-musl-64bit.zip; \
|
||||
rm -rf /var/lib/{apt,dpkg,cache,log}/; \
|
||||
echo "Installed base utils!"
|
||||
|
||||
ADD https://github.com/tstack/lnav/releases/download/v0.11.0-beta2/lnav-0.11.0-musl-64bit.zip /
|
||||
RUN unzip lnav-0.11.0-musl-64bit.zip
|
||||
|
||||
COPY docs/tutorials tutorials
|
||||
|
||||
RUN useradd -rm -d /home/logs -s /bin/bash logs
|
||||
@ -22,14 +23,20 @@ RUN useradd -rm -d /home/tutorial1 -s /bin/bash tutorial1
|
||||
RUN echo 'tutorial1:tutorial1' | chpasswd
|
||||
RUN passwd -d tutorial1
|
||||
|
||||
RUN useradd -rm -d /home/debug -s /bin/bash debug
|
||||
RUN echo 'debug:debug' | chpasswd
|
||||
|
||||
USER tutorial1
|
||||
RUN /lnav-0.11.0/lnav -nN -c ":config /ui/theme monocai"
|
||||
|
||||
USER root
|
||||
|
||||
RUN echo 'ForceCommand env LNAVSECURE=1 TERM=xterm-256color /lnav-0.11.0/lnav -c ":switch-to-view text" -I /tutorials/tutorial-lib /tutorials/tutorial1/tutorial1.glog /tutorials/tutorial1/index.md#tutorial-1' >> /etc/ssh/sshd_config
|
||||
RUN echo 'Match User logs' >> /etc/ssh/sshd_config
|
||||
RUN echo 'ForceCommand env LNAVSECURE=1 TERM=xterm-256color /lnav-0.11.0/lnav -d /tmp/lnav.err /demo' >> /etc/ssh/sshd_config
|
||||
RUN echo 'PermitEmptyPasswords yes' >> /etc/ssh/sshd_config
|
||||
RUN echo 'Match User tutorial1' >> /etc/ssh/sshd_config
|
||||
RUN echo 'ForceCommand env PATH=/lnav-0.11.0:$PATH /tutorials/tutorial1/run.sh' >> /etc/ssh/sshd_config
|
||||
RUN echo 'PermitEmptyPasswords yes' >> /etc/ssh/sshd_config
|
||||
RUN cat /etc/ssh/sshd_config
|
||||
RUN service ssh start
|
||||
EXPOSE 22
|
||||
|
||||
|
6
docs/tutorials/tutorial1/run.sh
Executable file
6
docs/tutorials/tutorial1/run.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
export LNAVSECURE=1
|
||||
export TERM=xterm-256color
|
||||
|
||||
lnav -I /tutorials/tutorial-lib /tutorials/tutorial1/tutorial1.glog /tutorials/tutorial1/index.md#tutorial-1
|
@ -1106,6 +1106,15 @@ exec_context::execute(const std::string& cmdline)
|
||||
void
|
||||
exec_context::add_error_context(lnav::console::user_message& um)
|
||||
{
|
||||
switch (um.um_level) {
|
||||
case lnav::console::user_message::level::raw:
|
||||
case lnav::console::user_message::level::info:
|
||||
case lnav::console::user_message::level::ok:
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (um.um_snippets.empty()) {
|
||||
um.with_snippets(this->ec_source);
|
||||
}
|
||||
|
11
src/lnav.cc
11
src/lnav.cc
@ -1194,11 +1194,18 @@ looper()
|
||||
|
||||
auto ecb_guard
|
||||
= lnav_data.ld_exec_context.add_error_callback([](const auto& um) {
|
||||
lnav_data.ld_user_message_source.replace_with(
|
||||
um.to_attr_line().rtrim());
|
||||
auto al = um.to_attr_line().rtrim();
|
||||
|
||||
if (al.get_string().find('\n') == std::string::npos) {
|
||||
if (lnav_data.ld_rl_view) {
|
||||
lnav_data.ld_rl_view->set_attr_value(al);
|
||||
}
|
||||
} else {
|
||||
lnav_data.ld_user_message_source.replace_with(al);
|
||||
lnav_data.ld_user_message_view.reload_data();
|
||||
lnav_data.ld_user_message_expiration
|
||||
= std::chrono::steady_clock::now() + 20s;
|
||||
}
|
||||
});
|
||||
|
||||
{
|
||||
|
@ -715,12 +715,14 @@ com_goto_mark(exec_context& ec,
|
||||
}
|
||||
|
||||
if (!new_top) {
|
||||
return ec.make_error(
|
||||
"no more {} bookmarks after here",
|
||||
auto um = lnav::console::user_message::info(fmt::format(
|
||||
FMT_STRING("no more {} bookmarks after here"),
|
||||
fmt::join(mark_types
|
||||
| lnav::itertools::map(
|
||||
&bookmark_type_t::get_name),
|
||||
", "));
|
||||
", ")));
|
||||
|
||||
return Err(um);
|
||||
}
|
||||
} else {
|
||||
for (const auto& bt : mark_types) {
|
||||
@ -733,7 +735,14 @@ com_goto_mark(exec_context& ec,
|
||||
}
|
||||
|
||||
if (!new_top) {
|
||||
return ec.make_error("no more bookmarks before here");
|
||||
auto um = lnav::console::user_message::info(fmt::format(
|
||||
FMT_STRING("no more {} bookmarks before here"),
|
||||
fmt::join(mark_types
|
||||
| lnav::itertools::map(
|
||||
&bookmark_type_t::get_name),
|
||||
", ")));
|
||||
|
||||
return Err(um);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user