summaryrefslogtreecommitdiff
path: root/cli/cli/man.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-11-09 13:01:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-11-09 13:01:13 +0200
commitcd3758bb328ff425bb06f18c81d3c353b508a336 (patch)
treeed8a85f7c01fa83852bb6d51e4fc2dd2a268b388 /cli/cli/man.cxx
parent9944c0e901d370316fe55fb845ad1c3c6721038d (diff)
Add --ascii-tree for translating UTF-8 tree(1) output to ASCII
Diffstat (limited to 'cli/cli/man.cxx')
-rw-r--r--cli/cli/man.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/cli/cli/man.cxx b/cli/cli/man.cxx
index df703e8..d446b2a 100644
--- a/cli/cli/man.cxx
+++ b/cli/cli/man.cxx
@@ -91,13 +91,16 @@ namespace
// n > 2 - arg string, short string, long string
//
size_t n (ds.size ());
- const string& d (
+ string d (
n == 1
? (cd_ == cd_short ? first_sentence (ds[0]) : ds[0])
: (n == 2
? (cd_ == cd_short ? first_sentence (ds[1]) : ds[1])
: ds[cd_ == cd_short ? 1 : 2]));
+ if (options.ascii_tree ())
+ preprocess_ascii_tree (d);
+
std::set<string> arg_set;
if (n > 1)
translate_arg (ds[0], arg_set);
@@ -149,6 +152,8 @@ namespace
if (type != "bool" || doc.size () >= 3)
{
+ // Note: we naturally assume this doesn't need --ascii-tree treatment.
+ //
string s (
translate_arg (
doc.size () > 0 ? doc[0] : string ("<arg>"), arg_set));
@@ -174,6 +179,9 @@ namespace
d = (cd_ == cd_short ? first_sentence (doc[1]) : doc[1]);
}
+ if (options.ascii_tree ())
+ preprocess_ascii_tree (d);
+
// Format the documentation string.
//
d = format (o.scope (), translate (d, arg_set), false);