Skip to content

Commit 722918f

Browse files
committed
Remove help_entry, which is now unused
All uses of `help_entry` have been converted to uses of `help_formatter`.
1 parent 28d4662 commit 722918f

File tree

3 files changed

+0
-68
lines changed

3 files changed

+0
-68
lines changed

Diff for: src/util/parse_options.cpp

-53
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ Author: Daniel Kroening, [email protected]
88

99
#include "parse_options.h"
1010

11-
#include <algorithm>
12-
#include <cctype>
1311
#include <climits>
1412

1513
#if defined (_WIN32)
@@ -178,54 +176,3 @@ banner_string(const std::string &front_end, const std::string &version)
178176

179177
return align_center_with_border(version_str);
180178
}
181-
182-
std::string help_entry(
183-
const std::string &option,
184-
const std::string &description,
185-
const std::size_t left_margin,
186-
const std::size_t width)
187-
{
188-
PRECONDITION(!option.empty());
189-
PRECONDITION(!std::isspace(option.front()));
190-
PRECONDITION(!std::isspace(option.back()));
191-
PRECONDITION(option.length() <= width);
192-
193-
PRECONDITION(!description.empty());
194-
PRECONDITION(!std::isspace(description.front()));
195-
PRECONDITION(!std::isspace(description.back()));
196-
197-
PRECONDITION(left_margin < width);
198-
199-
std::string result;
200-
201-
if(option.length() >= left_margin - 1)
202-
{
203-
result = " " + option + "\n";
204-
result += wrap_line(description, left_margin, width) + "\n";
205-
206-
return result;
207-
}
208-
209-
std::string padding(left_margin - option.length() - 1, ' ');
210-
result = " " + option + padding;
211-
212-
if(description.length() <= (width - left_margin))
213-
{
214-
return result + description + "\n";
215-
}
216-
217-
auto it = description.cbegin() + (width - left_margin);
218-
auto rit = std::reverse_iterator<decltype(it)>(it) - 1;
219-
220-
auto rit_space = std::find(rit, description.crend(), ' ');
221-
auto it_space = rit_space.base() - 1;
222-
CHECK_RETURN(*it_space == ' ');
223-
224-
result.append(description.cbegin(), it_space);
225-
result.append("\n");
226-
227-
result +=
228-
wrap_line(it_space + 1, description.cend(), left_margin, width) + "\n";
229-
230-
return result;
231-
}

Diff for: src/util/parse_options.h

-6
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,4 @@ banner_string(const std::string &front_end, const std::string &version);
6565
/// ```
6666
std::string align_center_with_border(const std::string &text);
6767

68-
std::string help_entry(
69-
const std::string &option,
70-
const std::string &description,
71-
const std::size_t left_margin = 30,
72-
const std::size_t width = 80);
73-
7468
#endif // CPROVER_UTIL_PARSE_OPTIONS_H

Diff for: unit/util/parse_options.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,3 @@ TEST_CASE("align_center_with_border", "[core][util]")
1515
align_center_with_border("test-text") ==
1616
"* * test-text * *");
1717
}
18-
19-
TEST_CASE("help_entry", "[core][util]")
20-
{
21-
REQUIRE(help_entry("--abc", "xyz", 8, 12) == " --abc xyz\n");
22-
REQUIRE(help_entry("--abc", "xxxx x", 8, 12) == " --abc xxxx\n x\n");
23-
REQUIRE(help_entry("--abc", "xx xx", 8, 12) == " --abc xx\n xx\n");
24-
REQUIRE(help_entry("--abcdef", "xyz", 8, 12) == " --abcdef\n xyz\n");
25-
REQUIRE(help_entry("--abcdefg", "xyz", 8, 12) == " --abcdefg\n xyz\n");
26-
}

0 commit comments

Comments
 (0)