... Both repeated option.
- \\ Positional. This should not appear in the help message.
+ try testHelp(.{ .markdown_lite = false },
+ \\ -a
+ \\ Short flag.
+ \\
+ \\ -b
+ \\ Short option.
+ \\
+ \\ --aa
+ \\ Long flag.
+ \\
+ \\ --bb
+ \\ Long option.
+ \\
+ \\ -c, --cc
+ \\ Both flag.
+ \\
+ \\ --complicate
+ \\ Flag with a complicated and
+ \\ very long description that
+ \\ spans multiple lines.
+ \\
+ \\ Paragraph number 2:
+ \\ * Bullet point
+ \\ * Bullet point
+ \\
+ \\
+ \\ Example:
+ \\ something something something
+ \\
+ \\ -d, --dd
+ \\ Both option.
+ \\
+ \\ -d, --dd ...
+ \\ Both repeated option.
\\
);
- try help(slice_stream.writer(), Help, ¶ms);
- const expected = "" ++
- "\t-a \tShort flag.\n" ++
- "\t-b \tShort option.\n" ++
- "\t --aa \tLong flag.\n" ++
- "\t --bb \tLong option.\n" ++
- "\t-c, --cc \tBoth flag.\n" ++
- "\t --complicate\tFlag with a complicated and\n" ++
- "\t \tvery long description that\n" ++
- "\t \tspans multiple lines.\n" ++
- "\t-d, --dd \tBoth option.\n" ++
- "\t-d, --dd ...\tBoth repeated option.\n";
+ try testHelp(.{ .indent = 0 },
+ \\-a
+ \\ Short flag.
+ \\
+ \\-b
+ \\ Short option.
+ \\
+ \\ --aa
+ \\ Long flag.
+ \\
+ \\ --bb
+ \\ Long option.
+ \\
+ \\-c, --cc
+ \\ Both flag.
+ \\
+ \\ --complicate
+ \\ Flag with a complicated and very long description that spans multiple lines.
+ \\
+ \\ Paragraph number 2:
+ \\ * Bullet point
+ \\ * Bullet point
+ \\
+ \\ Example:
+ \\ something something something
+ \\
+ \\-d, --dd
+ \\ Both option.
+ \\
+ \\-d, --dd ...
+ \\ Both repeated option.
+ \\
+ );
- try testing.expectEqualStrings(expected, slice_stream.getWritten());
+ try testHelp(.{ .indent = 0 },
+ \\-a
+ \\ Short flag.
+ \\
+ \\-b
+ \\ Short option.
+ \\
+ \\ --aa
+ \\ Long flag.
+ \\
+ \\ --bb
+ \\ Long option.
+ \\
+ \\-c, --cc
+ \\ Both flag.
+ \\
+ \\ --complicate
+ \\ Flag with a complicated and very long description that spans multiple lines.
+ \\
+ \\ Paragraph number 2:
+ \\ * Bullet point
+ \\ * Bullet point
+ \\
+ \\ Example:
+ \\ something something something
+ \\
+ \\-d, --dd
+ \\ Both option.
+ \\
+ \\-d, --dd ...
+ \\ Both repeated option.
+ \\
+ );
+
+ try testHelp(.{ .indent = 0, .max_width = 26 },
+ \\-a
+ \\ Short flag.
+ \\
+ \\-b
+ \\ Short option.
+ \\
+ \\ --aa
+ \\ Long flag.
+ \\
+ \\ --bb
+ \\ Long option.
+ \\
+ \\-c, --cc
+ \\ Both flag.
+ \\
+ \\ --complicate
+ \\ Flag with a
+ \\ complicated and
+ \\ very long
+ \\ description that
+ \\ spans multiple
+ \\ lines.
+ \\
+ \\ Paragraph number
+ \\ 2:
+ \\ * Bullet point
+ \\ * Bullet point
+ \\
+ \\ Example:
+ \\ something
+ \\ something
+ \\ something
+ \\
+ \\-d, --dd
+ \\ Both option.
+ \\
+ \\-d, --dd ...
+ \\ Both repeated
+ \\ option.
+ \\
+ );
+
+ try testHelp(.{
+ .indent = 0,
+ .max_width = 26,
+ .description_indent = 6,
+ },
+ \\-a
+ \\ Short flag.
+ \\
+ \\-b
+ \\ Short option.
+ \\
+ \\ --aa
+ \\ Long flag.
+ \\
+ \\ --bb
+ \\ Long option.
+ \\
+ \\-c, --cc
+ \\ Both flag.
+ \\
+ \\ --complicate
+ \\ Flag with a
+ \\ complicated and
+ \\ very long
+ \\ description that
+ \\ spans multiple
+ \\ lines.
+ \\
+ \\ Paragraph number 2:
+ \\ * Bullet point
+ \\ * Bullet point
+ \\
+ \\ Example:
+ \\ something
+ \\ something
+ \\ something
+ \\
+ \\-d, --dd
+ \\ Both option.
+ \\
+ \\-d, --dd ...
+ \\ Both repeated
+ \\ option.
+ \\
+ );
+
+ try testHelp(.{
+ .indent = 0,
+ .max_width = 46,
+ .description_on_new_line = false,
+ },
+ \\-a Short flag.
+ \\
+ \\-b Short option.
+ \\
+ \\ --aa Long flag.
+ \\
+ \\ --bb Long option.
+ \\
+ \\-c, --cc Both flag.
+ \\
+ \\ --complicate Flag with a
+ \\ complicated and very
+ \\ long description that
+ \\ spans multiple lines.
+ \\
+ \\ Paragraph number 2:
+ \\ * Bullet point
+ \\ * Bullet point
+ \\
+ \\ Example:
+ \\ something
+ \\ something
+ \\ something
+ \\
+ \\-d, --dd Both option.
+ \\
+ \\-d, --dd ... Both repeated option.
+ \\
+ );
+
+ try testHelp(.{
+ .indent = 0,
+ .max_width = 46,
+ .description_on_new_line = false,
+ .description_indent = 4,
+ },
+ \\-a Short flag.
+ \\
+ \\-b Short option.
+ \\
+ \\ --aa Long flag.
+ \\
+ \\ --bb Long option.
+ \\
+ \\-c, --cc Both flag.
+ \\
+ \\ --complicate Flag with a complicated
+ \\ and very long description
+ \\ that spans multiple
+ \\ lines.
+ \\
+ \\ Paragraph number 2:
+ \\ * Bullet point
+ \\ * Bullet point
+ \\
+ \\ Example:
+ \\ something something
+ \\ something
+ \\
+ \\-d, --dd Both option.
+ \\
+ \\-d, --dd ... Both repeated option.
+ \\
+ );
+
+ try testHelp(.{
+ .indent = 0,
+ .max_width = 46,
+ .description_on_new_line = false,
+ .description_indent = 4,
+ .spacing_between_parameters = 0,
+ },
+ \\-a Short flag.
+ \\-b Short option.
+ \\ --aa Long flag.
+ \\ --bb Long option.
+ \\-c, --cc Both flag.
+ \\ --complicate Flag with a complicated
+ \\ and very long description
+ \\ that spans multiple
+ \\ lines.
+ \\
+ \\ Paragraph number 2:
+ \\ * Bullet point
+ \\ * Bullet point
+ \\
+ \\ Example:
+ \\ something something
+ \\ something
+ \\-d, --dd Both option.
+ \\-d, --dd ... Both repeated option.
+ \\
+ );
+
+ try testHelp(.{
+ .indent = 0,
+ .max_width = 46,
+ .description_on_new_line = false,
+ .description_indent = 4,
+ .spacing_between_parameters = 2,
+ },
+ \\-a Short flag.
+ \\
+ \\
+ \\-b Short option.
+ \\
+ \\
+ \\ --aa Long flag.
+ \\
+ \\
+ \\ --bb Long option.
+ \\
+ \\
+ \\-c, --cc Both flag.
+ \\
+ \\
+ \\ --complicate Flag with a complicated
+ \\ and very long description
+ \\ that spans multiple
+ \\ lines.
+ \\
+ \\ Paragraph number 2:
+ \\ * Bullet point
+ \\ * Bullet point
+ \\
+ \\ Example:
+ \\ something something
+ \\ something
+ \\
+ \\
+ \\-d, --dd Both option.
+ \\
+ \\
+ \\-d, --dd ... Both repeated option.
+ \\
+ );
}
/// Will print a usage message in the following format:
@@ -1104,7 +1699,6 @@ pub fn usage(stream: anytype, comptime Id: type, params: []const Param(Id)) !voi
continue;
const prefix = if (param.names.short) |_| "-" else "--";
-
const name = if (param.names.short) |*s|
// Seems the zig compiler is being a little wierd. I doesn't allow me to write
// @as(*const [1]u8, s)
--
cgit v1.2.3