• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tstack / lnav / 17589970077-2502

09 Sep 2025 05:00PM UTC coverage: 65.196% (-5.0%) from 70.225%
17589970077-2502

push

github

tstack
[format] add fields for source file/line

Knowing the source file/line context in a log
message can help find log messages when using
log2src.

56 of 70 new or added lines in 2 files covered. (80.0%)

13954 existing lines in 210 files now uncovered.

45516 of 69814 relevant lines covered (65.2%)

404154.37 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/src/help_text.cc
1
/**
2
 * Copyright (c) 2020, Timothy Stack
3
 *
4
 * All rights reserved.
5
 *
6
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions are met:
8
 *
9
 * * Redistributions of source code must retain the above copyright notice, this
10
 * list of conditions and the following disclaimer.
11
 * * Redistributions in binary form must reproduce the above copyright notice,
12
 * this list of conditions and the following disclaimer in the documentation
13
 * and/or other materials provided with the distribution.
14
 * * Neither the name of Timothy Stack nor the names of its contributors
15
 * may be used to endorse or promote products derived from this software
16
 * without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ''AS IS'' AND ANY
19
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
22
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 */
29

30
#include "help_text.hh"
31

32
#include "config.h"
33

34
help_text&
35
help_text::with_parameters(
×
36
    const std::initializer_list<help_text>& params) noexcept
37
{
38
    this->ht_parameters = params;
×
39
    for (auto& param : this->ht_parameters) {
×
40
        param.ht_context = help_context_t::HC_PARAMETER;
×
41
    }
42
    return *this;
×
43
}
44

45
help_text&
46
help_text::with_parameter(const help_text& ht) noexcept
420,946✔
47
{
48
    this->ht_parameters.emplace_back(ht);
420,946✔
49
    this->ht_parameters.back().ht_context = help_context_t::HC_PARAMETER;
420,946✔
50
    return *this;
420,946✔
51
}
52

53
help_text&
54
help_text::with_result(const help_text& ht) noexcept
46,928✔
55
{
56
    this->ht_results.emplace_back(ht);
46,928✔
57
    this->ht_results.back().ht_context = help_context_t::HC_RESULT;
46,928✔
58
    return *this;
46,928✔
59
}
60

61
help_text&
62
help_text::with_examples(
3,465✔
63
    const std::initializer_list<help_example>& examples) noexcept
64
{
65
    this->ht_example = examples;
3,465✔
66
    return *this;
3,465✔
67
}
68

69
help_text&
70
help_text::with_example(const help_example& example) noexcept
310,091✔
71
{
72
    this->ht_example.emplace_back(example);
310,091✔
73
    return *this;
310,091✔
74
}
75

76
bool
UNCOV
77
help_text::is_trailing_arg() const
×
78
{
UNCOV
79
    switch (this->ht_format) {
×
UNCOV
80
        case help_parameter_format_t::HPF_TEXT:
×
81
        case help_parameter_format_t::HPF_TIME_FILTER_POINT:
82
        case help_parameter_format_t::HPF_MULTILINE_TEXT:
83
        case help_parameter_format_t::HPF_REGEX:
84
        case help_parameter_format_t::HPF_SQL:
85
        case help_parameter_format_t::HPF_SQL_EXPR:
UNCOV
86
            return true;
×
UNCOV
87
        default:
×
UNCOV
88
            return false;
×
89
    }
90
}
91

92
help_text&
93
help_text::with_enum_values(
7,995✔
94
    const std::initializer_list<string_fragment>& enum_values) noexcept
95
{
96
    this->ht_enum_values = enum_values;
7,995✔
97
    return *this;
7,995✔
98
}
99

100
help_text&
101
help_text::with_tags(const std::initializer_list<const char*>& tags) noexcept
193,309✔
102
{
103
    this->ht_tags = tags;
193,309✔
104
    return *this;
193,309✔
105
}
106

107
help_text&
108
help_text::with_opposites(
16,632✔
109
    const std::initializer_list<const char*>& opps) noexcept
110
{
111
    this->ht_opposites = opps;
16,632✔
112
    return *this;
16,632✔
113
}
114

115
help_text&
116
help_text::with_prql_path(
34,089✔
117
    const std::initializer_list<const char*>& prql) noexcept
118
{
119
    this->ht_prql_path = prql;
34,089✔
120
    return *this;
34,089✔
121
}
122

123
std::multimap<std::string, help_text*>&
124
help_text::tag_map()
209,254✔
125
{
126
    static std::multimap<std::string, help_text*> retval;
209,254✔
127

128
    return retval;
209,254✔
129
}
130

131
void
132
help_text::index_tags()
246,709✔
133
{
134
    for (const auto& tag : this->ht_tags) {
454,802✔
135
        tag_map().insert(std::make_pair(tag, this));
208,093✔
136
    }
137
}
246,709✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc