diff options
author | uki00a <uki00a@gmail.com> | 2020-06-04 04:40:50 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-03 21:40:50 +0200 |
commit | 9bd5c08d5a2a9cdd2649dd24a4d6b26d9af2a4c4 (patch) | |
tree | ab762caca762e1c859a96985731c1f97bded74c5 /cli/doc/printer.rs | |
parent | fcae2fec879caf26ebe7af17b30a3bce6322b85d (diff) |
feat(doc): handle detail output for enum (#6078)
Diffstat (limited to 'cli/doc/printer.rs')
-rw-r--r-- | cli/doc/printer.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cli/doc/printer.rs b/cli/doc/printer.rs index d7a754933..d24e65901 100644 --- a/cli/doc/printer.rs +++ b/cli/doc/printer.rs @@ -41,6 +41,7 @@ pub fn format_details(node: doc::DocNode) -> String { let maybe_extra = match node.kind { DocNodeKind::Class => Some(format_class_details(node)), + DocNodeKind::Enum => Some(format_enum_details(node)), DocNodeKind::Namespace => Some(format_namespace_details(node)), _ => None, }; @@ -412,6 +413,17 @@ fn format_class_details(node: doc::DocNode) -> String { details } +fn format_enum_details(node: doc::DocNode) -> String { + let mut details = String::new(); + let enum_def = node.enum_def.unwrap(); + for member in enum_def.members { + details + .push_str(&add_indent(format!("{}\n", colors::bold(member.name)), 1)); + } + details.push_str("\n"); + details +} + fn format_namespace_details(node: doc::DocNode) -> String { let mut ns = String::new(); |