diff --git a/docs/reference/rew-ascii.md b/docs/reference/rew-ascii.md
index bf079279..dd67b970 100644
--- a/docs/reference/rew-ascii.md
+++ b/docs/reference/rew-ascii.md
@@ -10,10 +10,15 @@ rew ascii [OPTIONS]
## Options
-### `-d, --delete`
+
+-d, --delete
+-
Delete non-ASCII characters instead of converting them
+
+
+
## Global options
See [rew reference](rew.md#global-options) for list of additional global options.
diff --git a/docs/reference/rew-first.md b/docs/reference/rew-first.md
index dd528f96..d186ce76 100644
--- a/docs/reference/rew-first.md
+++ b/docs/reference/rew-first.md
@@ -10,12 +10,17 @@ rew first [COUNT]
## Arguments
-### `COUNT`
+
+COUNT
+-
Maximum number of lines to print
**Default value**: `1`
+
+
+
## Global options
See [rew reference](rew.md#global-options) for list of additional global options.
diff --git a/docs/reference/rew-join.md b/docs/reference/rew-join.md
index 5fbd13ef..534b257c 100644
--- a/docs/reference/rew-join.md
+++ b/docs/reference/rew-join.md
@@ -10,18 +10,28 @@ rew join [OPTIONS] [SEPARATOR]
## Arguments
-### `SEPARATOR`
+
+SEPARATOR
+-
Separator
**Default value**: `''`
+
+
+
## Options
-### `-t, --trailing`
+
+-t, --trailing
+-
Print trailing separator
+
+
+
## Global options
See [rew reference](rew.md#global-options) for list of additional global options.
diff --git a/docs/reference/rew-last.md b/docs/reference/rew-last.md
index 952e849a..55ab86c8 100644
--- a/docs/reference/rew-last.md
+++ b/docs/reference/rew-last.md
@@ -10,12 +10,17 @@ rew last [COUNT]
## Arguments
-### `COUNT`
+
+COUNT
+-
Maximum number of lines to print
**Default value**: `1`
+
+
+
## Global options
See [rew reference](rew.md#global-options) for list of additional global options.
diff --git a/docs/reference/rew-seq.md b/docs/reference/rew-seq.md
index 15908211..3d0dcd01 100644
--- a/docs/reference/rew-seq.md
+++ b/docs/reference/rew-seq.md
@@ -10,18 +10,25 @@ rew seq [FIRST] [INCREMENT]
## Arguments
-### `FIRST`
+
+FIRST
+-
First number in sequence
**Default value**: `1`
-### `INCREMENT`
+
+INCREMENT
+-
Increment between numbers
**Default value**: `1`
+
+
+
## Global options
See [rew reference](rew.md#global-options) for list of additional global options.
diff --git a/docs/reference/rew-skip.md b/docs/reference/rew-skip.md
index cf10da1a..03463c6c 100644
--- a/docs/reference/rew-skip.md
+++ b/docs/reference/rew-skip.md
@@ -10,10 +10,15 @@ rew skip
## Arguments
-### `COUNT`
+
+COUNT
+-
Number of lines to skip
+
+
+
## Global options
See [rew reference](rew.md#global-options) for list of additional global options.
diff --git a/docs/reference/rew-split.md b/docs/reference/rew-split.md
index 35b3b7f0..3afab22e 100644
--- a/docs/reference/rew-split.md
+++ b/docs/reference/rew-split.md
@@ -10,16 +10,26 @@ rew split [OPTIONS]
## Arguments
-### `SEPARATOR`
+
+SEPARATOR
+-
Separator (single byte character)
+
+
+
## Options
-### `-t, --trailing`
+
+-t, --trailing
+-
Ignore trailing separator
+
+
+
## Global options
See [rew reference](rew.md#global-options) for list of additional global options.
diff --git a/docs/reference/rew-stream.md b/docs/reference/rew-stream.md
index e9993127..fc330bf2 100644
--- a/docs/reference/rew-stream.md
+++ b/docs/reference/rew-stream.md
@@ -10,10 +10,15 @@ rew stream [VALUES]...
## Arguments
-### `VALUES`
+
+VALUES
+-
Values to print
+
+
+
## Global options
See [rew reference](rew.md#global-options) for list of additional global options.
diff --git a/docs/reference/rew-trim.md b/docs/reference/rew-trim.md
index 37f720db..fbf11852 100644
--- a/docs/reference/rew-trim.md
+++ b/docs/reference/rew-trim.md
@@ -12,14 +12,21 @@ rew trim [OPTIONS]
## Options
-### `-s, --start`
+
+-s, --start
+-
Trim the beginning
-### `-e, --end`
+
+-e, --end
+-
Trim the end
+
+
+
## Global options
See [rew reference](rew.md#global-options) for list of additional global options.
diff --git a/docs/reference/rew-x.md b/docs/reference/rew-x.md
index 742aa967..81bc7c38 100644
--- a/docs/reference/rew-x.md
+++ b/docs/reference/rew-x.md
@@ -10,18 +10,28 @@ rew x [OPTIONS]
## Arguments
-### `PATTERN`
+
+PATTERN
+-
Composition pattern
+
+
+
## Options
-### `-e, --escape`
+
+-e, --escape
+-
Escape character for the pattern
**Default value**: `\`
+
+
+
## Global options
See [rew reference](rew.md#global-options) for list of additional global options.
diff --git a/docs/reference/rew.md b/docs/reference/rew.md
index 78dbe095..4f910d56 100644
--- a/docs/reference/rew.md
+++ b/docs/reference/rew.md
@@ -10,31 +10,52 @@ rew [OPTIONS]
## Commands
-- [ascii](./rew-ascii.md) - Convert characters to ASCII
-- [first](./rew-first.md) - Print only the first N lines
-- [last](./rew-last.md) - Print only the last N lines
-- [lower](./rew-lower.md) - Convert characters to lowercase
-- [join](./rew-join.md) - Join lines using a separator
-- [x ](./rew-x.md) - Compose commands using a pattern
-- [norm](./rew-norm.md) - Normalize line separators to LF
-- [loop](./rew-loop.md) - Repeat all lines in a loop
-- [seq](./rew-seq.md) - Generate infinite sequence of numbers
-- [sink](./rew-sink.md) - Throw away all input
-- [skip](./rew-skip.md) - Skip N lines and print the rest
-- [split](./rew-split.md) - Split input to lines using a separator
-- [stream](./rew-stream.md) - Print arguments as lines
-- [trim](./rew-trim.md) - Trim whitespaces from each line
-- [upper](./rew-upper.md) - Convert characters to lowercase
+
+ascii
+- Convert characters to ASCII
+first
+- Print only the first N lines
+last
+- Print only the last N lines
+lower
+- Convert characters to lowercase
+join
+- Join lines using a separator
+x
+- Compose commands using a pattern
+norm
+- Normalize line separators to LF
+loop
+- Repeat all lines in a loop
+seq
+- Generate infinite sequence of numbers
+sink
+- Throw away all input
+skip
+- Skip N lines and print the rest
+split
+- Split input to lines using a separator
+stream
+- Print arguments as lines
+trim
+- Trim whitespaces from each line
+upper
+- Convert characters to lowercase
+
## Global options
-### `-0, --null`
+
+-0, --null
+-
Line delimiter is NUL, not newline
**Environment variable**: `REW_NULL`
-### `--buff`
+
+--buff
+-
Output buffering.
@@ -45,7 +66,9 @@ Output buffering.
**Environment variable**: `REW_BUFF`
-### `--max-line`
+
+--max-line
+-
Maximum size of an input line.
@@ -57,3 +80,6 @@ Using `0` as a value will disable the limit.
**Environment variable**: `REW_MAX_LINE`
+
+
+
diff --git a/xtask/src/gen_docs.rs b/xtask/src/gen_docs.rs
index 03adcbb4..3967006c 100644
--- a/xtask/src/gen_docs.rs
+++ b/xtask/src/gen_docs.rs
@@ -103,11 +103,13 @@ fn generate_docs_file<'a>(
if !subcommands.is_empty() {
writeln!(&mut writer, "## Commands")?;
writeln!(&mut writer)?;
+ writeln!(&mut writer, "")?;
for subcommand in &subcommands {
write_subcommand(&mut writer, subcommand, &command_path)?;
}
+ writeln!(&mut writer, "
")?;
writeln!(&mut writer)?;
}
@@ -119,11 +121,15 @@ fn generate_docs_file<'a>(
if !arguments.is_empty() {
writeln!(&mut writer, "## Arguments")?;
writeln!(&mut writer)?;
+ writeln!(&mut writer, "")?;
for arg in arguments {
write_argument(&mut writer, arg)
.with_context(|| format!("Failed to process command '{}'", command_call))?;
}
+
+ writeln!(&mut writer, "
")?;
+ writeln!(&mut writer)?;
}
let options: Vec<&Arg> = command
@@ -134,11 +140,15 @@ fn generate_docs_file<'a>(
if !options.is_empty() {
writeln!(&mut writer, "## Options")?;
writeln!(&mut writer)?;
+ writeln!(&mut writer, "")?;
for opt in options {
write_argument(&mut writer, opt)
.with_context(|| format!("Failed to process command '{}'", command_call))?;
}
+
+ writeln!(&mut writer, "
")?;
+ writeln!(&mut writer)?;
}
let global_options: Vec<&Arg> = command
@@ -146,7 +156,7 @@ fn generate_docs_file<'a>(
.filter(|arg| !arg.is_positional() && arg.is_global_set())
.collect();
- if !global_options.is_empty() || parent_global_options {
+ if parent_global_options || !global_options.is_empty() {
writeln!(&mut writer, "## Global options")?;
writeln!(&mut writer)?;
@@ -159,9 +169,16 @@ fn generate_docs_file<'a>(
writeln!(&mut writer)?;
}
- for opt in &global_options {
- write_argument(&mut writer, opt)
- .with_context(|| format!("Failed to process command '{}'", command_call))?;
+ if !global_options.is_empty() {
+ writeln!(&mut writer, "")?;
+
+ for opt in &global_options {
+ write_argument(&mut writer, opt)
+ .with_context(|| format!("Failed to process command '{}'", command_call))?;
+ }
+
+ writeln!(&mut writer, "
")?;
+ writeln!(&mut writer)?;
}
}
@@ -205,7 +222,8 @@ fn write_argument(mut writer: &mut BufWriter, arg: &Arg) -> Result<()> {
.or_else(|| arg.get_help())
.ok_or_else(|| anyhow!("Expected '{}' argument to have help", arg.get_id()))?;
- writeln!(&mut writer, "### `{}`", names.join(", "))?;
+ writeln!(&mut writer, "{}
", names.join(", "))?;
+ writeln!(&mut writer, "")?;
writeln!(&mut writer)?;
writeln!(&mut writer, "{}", help)?;
writeln!(&mut writer)?;
@@ -247,6 +265,7 @@ fn write_argument(mut writer: &mut BufWriter, arg: &Arg) -> Result<()> {
}
}
+ writeln!(&mut writer, "")?;
Ok(())
}
@@ -267,7 +286,13 @@ fn write_subcommand(
.get_about()
.ok_or_else(|| anyhow!("Expected '{}' command to have about", call))?;
- writeln!(&mut writer, "- [{}](./{}.md) - {}", title, stem, about)?;
+ //writeln!(&mut writer, "- [{}](./{}.md) - {}", title, stem, about)?;
+ writeln!(
+ &mut writer,
+ "{}
",
+ stem, title
+ )?;
+ writeln!(&mut writer, "{}", about)?;
Ok(())
}