Skip to content

Commit bda21be

Browse files
chore: improve CLI line breaks and markdown-handling (maplibre#1736)
During maplibre#1720 I noticed that there are a few places in the CLI where a few more line breaks and handling markdown better could help readability. Yes, this adds the `unstable-markdown` feature of clap, but given that removal would only impact the CLI-Formatting, I think here the risk is okay. Tracking issue: - clap-rs/clap#5900 Hidden rationale: I have one place in maplibre#1720 where making it readable without markdown formatting is nearly impossible --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent a8f904d commit bda21be

File tree

4 files changed

+37
-18
lines changed

4 files changed

+37
-18
lines changed

docs/src/run-with-cli.md

+21-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
## Command-line Interface
22

3-
You can configure Martin using command-line interface. See `martin --help` or `cargo run -- --help` for more
4-
information.
3+
You can configure Martin using command-line interface.
4+
See `martin --help` or `cargo run -- --help` for more information:
55

66
```text
7+
Blazing fast and lightweight tile server with PostGIS, MBTiles, and PMTiles support
8+
79
Usage: martin [OPTIONS] [CONNECTION]...
810
911
Arguments:
@@ -15,7 +17,8 @@ Options:
1517
Path to config file. If set, no tile source-related parameters are allowed
1618
1719
--save-config <SAVE_CONFIG>
18-
Save resulting config to a file or use "-" to print to stdout. By default, only print if sources are auto-detected
20+
Save resulting config to a file or use "-" to print to stdout.
21+
By default, only print if sources are auto-detected
1922
2023
-C, --cache-size <CACHE_SIZE>
2124
Main cache size (in MB)
@@ -33,24 +36,30 @@ Options:
3336
The socket address to bind. [DEFAULT: 0.0.0.0:3000]
3437
3538
--base-path <BASE_PATH>
36-
Set TileJSON URL path prefix. This overrides the default of respecting the X-Rewrite-URL header.
37-
Only modifies the JSON (TileJSON) returned, martins' API-URLs remain unchanged. If you need to rewrite URLs, please use a reverse proxy.
38-
Must begin with a `/`.
39-
Examples: `/`, `/tiles`
39+
Set TileJSON URL path prefix.
40+
41+
This overrides the default of respecting the X-Rewrite-URL header.
42+
Only modifies the JSON (TileJSON) returned, martins' API-URLs remain unchanged.
43+
If you need to rewrite URLs, please use a reverse proxy.
44+
Must begin with a /.
45+
46+
Examples: /, /tiles
4047
4148
-W, --workers <WORKERS>
4249
Number of web server workers
4350
4451
--preferred-encoding <PREFERRED_ENCODING>
45-
Martin server preferred tile encoding. If the client accepts multiple compression formats, and the tile source is not pre-compressed, which compression should be used. `gzip` is faster, but `brotli` is smaller, and may be faster with caching. Defaults to gzip
52+
Martin server preferred tile encoding. [DEFAULT: gzip]
53+
54+
If the client accepts multiple compression formats, and the tile source is not pre-compressed, which compression should be used. gzip is faster, but brotli is smaller, and may be faster with caching.
4655
4756
[possible values: brotli, gzip]
4857
4958
-u, --webui <WEB_UI>
50-
Control Martin web UI. Disabled by default
59+
Control Martin web UI. [DEFAULT: disabled]
5160
5261
Possible values:
53-
- disable: Disable Web UI interface. This is the default, but once implemented, the default will be enabled for localhost
62+
- disable: Disable Web UI interface. This is the default, but once implemented, the default will be enabled for localhost.
5463
- enable-for-all: Enable Web UI interface on all connections
5564
5665
-b, --auto-bounds <AUTO_BOUNDS>
@@ -78,4 +87,6 @@ Options:
7887
7988
-V, --version
8089
Print version
90+
91+
Use RUST_LOG environment variable to control logging level, e.g. RUST_LOG=debug or RUST_LOG=martin=debug. See https://docs.rs/env_logger/latest/env_logger/index.html#enabling-logging for more information.
8192
```

martin/src/args/root.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub struct MetaArgs {
5656
/// **Deprecated** Scan for new sources on sources list requests
5757
#[arg(short, long, hide = true)]
5858
pub watch: bool,
59-
/// Connection strings, e.g. postgres://... or /path/to/files
59+
/// Connection strings, e.g. `postgres://...` or `/path/to/files`
6060
pub connection: Vec<String>,
6161
}
6262

martin/src/args/srv.rs

+12-5
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,26 @@ pub struct SrvArgs {
1111
pub keep_alive: Option<u64>,
1212
#[arg(help = format!("The socket address to bind. [DEFAULT: {LISTEN_ADDRESSES_DEFAULT}]"), short, long)]
1313
pub listen_addresses: Option<String>,
14-
/// Set TileJSON URL path prefix. This overrides the default of respecting the X-Rewrite-URL header.
15-
/// Only modifies the JSON (TileJSON) returned, martins' API-URLs remain unchanged. If you need to rewrite URLs, please use a reverse proxy.
14+
/// Set TileJSON URL path prefix.
15+
///
16+
/// This overrides the default of respecting the X-Rewrite-URL header.
17+
/// Only modifies the JSON (TileJSON) returned, martins' API-URLs remain unchanged.
18+
/// If you need to rewrite URLs, please use a reverse proxy.
1619
/// Must begin with a `/`.
20+
///
1721
/// Examples: `/`, `/tiles`
1822
#[arg(long)]
1923
pub base_path: Option<String>,
2024
/// Number of web server workers
2125
#[arg(short = 'W', long)]
2226
pub workers: Option<usize>,
23-
/// Martin server preferred tile encoding. If the client accepts multiple compression formats, and the tile source is not pre-compressed, which compression should be used. `gzip` is faster, but `brotli` is smaller, and may be faster with caching. Defaults to gzip.
27+
/// Martin server preferred tile encoding. [DEFAULT: gzip]
28+
///
29+
/// If the client accepts multiple compression formats, and the tile source is not pre-compressed, which compression should be used.
30+
/// `gzip` is faster, but `brotli` is smaller, and may be faster with caching.
2431
#[arg(long)]
2532
pub preferred_encoding: Option<PreferredEncoding>,
26-
/// Control Martin web UI. Disabled by default.
33+
/// Control Martin web UI. [DEFAULT: disabled]
2734
#[arg(short = 'u', long = "webui")]
2835
#[cfg(feature = "webui")]
2936
pub web_ui: Option<WebUiMode>,
@@ -46,7 +53,7 @@ pub struct SrvArgs {
4653
#[derive(PartialEq, Eq, Debug, Clone, Copy, Default, Serialize, Deserialize, ValueEnum)]
4754
#[serde(rename_all = "lowercase")]
4855
pub enum WebUiMode {
49-
/// Disable Web UI interface. This is the default, but once implemented, the default will be enabled for localhost.
56+
/// Disable Web UI interface. ***This is the default, but once implemented, the default will be enabled for localhost.***
5057
#[default]
5158
#[serde(alias = "false")]
5259
Disable,

martin/src/bin/martin-cp.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub struct CopyArgs {
7474
/// Path to the mbtiles file to copy to.
7575
#[arg(short, long)]
7676
pub output_file: PathBuf,
77-
/// Output format of the new destination file. Ignored if the file exists. Defaults to 'normalized'.
77+
/// Output format of the new destination file. Ignored if the file exists. [DEFAULT: normalized]
7878
#[arg(
7979
long = "mbtiles-type",
8080
alias = "dst-type",
@@ -86,6 +86,7 @@ pub struct CopyArgs {
8686
#[arg(long)]
8787
pub url_query: Option<String>,
8888
/// Optional accepted encoding parameter as if the browser sent it in the HTTP request.
89+
///
8990
/// If set to multiple values like `gzip,br`, martin-cp will use the first encoding,
9091
/// or re-encode if the tile is already encoded and that encoding is not listed.
9192
/// Use `identity` to disable compression. Ignored for non-encodable tiles like PNG and JPEG.
@@ -117,7 +118,7 @@ pub struct CopyArgs {
117118
/// Skip generating a global hash for mbtiles validation. By default, `martin-cp` will compute and update `agg_tiles_hash` metadata value.
118119
#[arg(long)]
119120
pub skip_agg_tiles_hash: bool,
120-
/// Set additional metadata values. Must be set as "key=value" pairs. Can be specified multiple times.
121+
/// Set additional metadata values. Must be set as `"key=value"` pairs. Can be specified multiple times.
121122
#[arg(long, value_name="KEY=VALUE", value_parser = parse_key_value)]
122123
pub set_meta: Vec<(String, String)>,
123124
}

0 commit comments

Comments
 (0)