SeqAn3
3.4.0
The Modern C++ library for sequence analysis.
Toggle main menu visibility
Loading...
Searching...
No Matches
format_man.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3
// SPDX-License-Identifier: BSD-3-Clause
4
9
10
#pragma once
11
12
#include <
iostream
>
13
14
#include <
seqan3/argument_parser/detail/format_base.hpp
>
15
#include <
seqan3/argument_parser/detail/terminal.hpp
>
16
#include <
seqan3/version.hpp
>
17
18
namespace
seqan3::detail
19
{
20
34
class
format_man :
public
format_help_base<format_man>
35
{
37
using
base_type = format_help_base<format_man>;
38
40
friend
base_type;
41
42
public
:
46
format_man() =
default
;
47
format_man(format_man
const
& pf) =
default
;
48
format_man & operator=(format_man
const
& pf) =
default
;
49
format_man(format_man &&) =
default
;
50
format_man & operator=(format_man &&) =
default
;
51
~format_man() =
default
;
52
54
format_man(std::vector<std::string>
const
& names,
bool
const
advanced
=
false
) : base_type{names,
advanced
} {};
56
57
private
:
59
void
print_header()
60
{
61
std::ostream_iterator<char> out(std::cout);
62
63
// Print .TH line.
64
std::cout <<
".TH "
;
65
std::transform
(meta.app_name.begin(),
66
meta.app_name.end(),
67
out,
68
[](
unsigned
char
c)
69
{
70
return std::toupper(c);
71
});
72
std::cout <<
" "
<<
std::to_string
(meta.man_page_section) <<
" \""
<< meta.date <<
"\" \""
;
73
std::transform
(meta.app_name.begin(),
74
meta.app_name.end(),
75
out,
76
[](
unsigned
char
c)
77
{
78
return std::tolower(c);
79
});
80
std::cout <<
" "
<< meta.version <<
"\" \""
<< meta.man_page_title <<
"\"\n"
;
81
82
// Print NAME section.
83
std::cout <<
".SH NAME\n"
<< meta.app_name <<
" \\- "
<< meta.short_description <<
std::endl
;
84
}
85
89
void
print_section(std::string
const
& title)
90
{
91
std::ostream_iterator<char> out(std::cout);
92
std::cout <<
".SH "
;
93
std::transform
(title.
begin
(),
94
title.
end
(),
95
out,
96
[](
unsigned
char
c)
97
{
98
return std::toupper(c);
99
});
100
std::cout <<
"\n"
;
101
is_first_in_section =
true
;
102
}
103
107
void
print_subsection(std::string
const
& title)
108
{
109
std::cout <<
".SS "
<< title <<
"\n"
;
110
is_first_in_section =
true
;
111
}
112
119
void
print_line(std::string
const
& text,
bool
const
line_is_paragraph)
120
{
121
if
(!is_first_in_section && line_is_paragraph)
122
std::cout <<
".sp\n"
;
123
else
if
(!is_first_in_section && !line_is_paragraph)
124
std::cout <<
".br\n"
;
125
126
std::cout << text <<
"\n"
;
127
is_first_in_section =
false
;
128
}
129
139
void
print_list_item(std::string
const
& term, std::string
const
& desc)
140
{
141
std::cout <<
".TP\n"
<< term <<
"\n"
<< desc <<
"\n"
;
142
is_first_in_section =
false
;
143
}
144
146
void
print_footer()
147
{
148
// no footer
149
}
150
155
std::string in_bold(std::string
const
& str)
156
{
157
return
"\\fB"
+ str +
"\\fR"
;
158
}
159
161
bool
is_first_in_section{
true
};
162
};
163
164
}
// namespace seqan3::detail
std::string::begin
T begin(T... args)
std::string::end
T end(T... args)
std::endl
T endl(T... args)
format_base.hpp
Provides the format_base struct containing all helper functions that are needed in all formats.
seqan3::advanced
@ advanced
Definition
auxiliary.hpp:256
iostream
terminal.hpp
Checks if program is run interactively and retrieves dimensions of terminal (Transferred from seqan2)...
std::to_string
T to_string(T... args)
std::transform
T transform(T... args)
version.hpp
Provides SeqAn version macros and global variables.
Hide me
Version:
seqan3
argument_parser
detail
format_man.hpp
Generated on
for SeqAn3 by
1.17.0