Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ approx = "0.5.1"
async-trait = "0.1"
bit-set = "0.8"
brotli = ">=5, <9"
clap = { version = "4", features = ["derive", "unstable-markdown"] }
clap = { version = "4", features = ["derive", "unstable-markdown", "wrap_help"] }
criterion = { version = "0.5", features = ["async_futures", "async_tokio", "html_reports"] }
ctor = "0.4.2"
dashmap = { version = "6.1.0", features = ["serde", "inline", "rayon"] }
Expand Down
15 changes: 13 additions & 2 deletions martin/src/args/root.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use std::path::PathBuf;

use clap::Parser;
use clap::{
Parser,
builder::{Styles, styling::AnsiColor},
};
use log::warn;

use crate::MartinError::ConfigAndConnectionsError;
Expand All @@ -19,11 +22,19 @@ use crate::config::Config;
))]
use crate::file_config::FileConfigEnum;

/// Defines the styles used for the CLI help output.
const HELP_STYLES: Styles = Styles::styled()
.header(AnsiColor::Blue.on_default().bold())
.usage(AnsiColor::Blue.on_default().bold())
.literal(AnsiColor::White.on_default())
.placeholder(AnsiColor::Green.on_default());

#[derive(Parser, Debug, PartialEq, Default)]
#[command(
about,
version,
after_help = "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."
after_help = "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.",
styles = HELP_STYLES
)]
pub struct Args {
#[command(flatten)]
Expand Down
14 changes: 12 additions & 2 deletions martin/src/bin/martin-cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ use std::time::Duration;
use actix_http::error::ParseError;
use actix_http::test::TestRequest;
use actix_web::http::header::{ACCEPT_ENCODING, AcceptEncoding, Header as _};
use clap::Parser;
use clap::{
Parser,
builder::{Styles, styling::AnsiColor},
};
use futures::TryStreamExt;
use futures::stream::{self, StreamExt};
use log::{debug, error, info, log_enabled};
Expand All @@ -34,12 +37,19 @@ const SAVE_EVERY: Duration = Duration::from_secs(60);
const PROGRESS_REPORT_AFTER: u64 = 100;
const PROGRESS_REPORT_EVERY: Duration = Duration::from_secs(2);
const BATCH_SIZE: usize = 1000;
/// Defines the styles used for the CLI help output.
const HELP_STYLES: Styles = Styles::styled()
.header(AnsiColor::Blue.on_default().bold())
.usage(AnsiColor::Blue.on_default().bold())
.literal(AnsiColor::White.on_default())
.placeholder(AnsiColor::Green.on_default());

#[derive(Parser, Debug, PartialEq, Default)]
#[command(
about = "A tool to bulk copy tiles from any Martin-supported sources into an mbtiles file",
version,
after_help = "Use RUST_LOG environment variable to control logging level, e.g. RUST_LOG=debug or RUST_LOG=martin_cp=debug. See https://docs.rs/env_logger/latest/env_logger/index.html#enabling-logging for more information."
after_help = "Use RUST_LOG environment variable to control logging level, e.g. RUST_LOG=debug or RUST_LOG=martin_cp=debug. See https://docs.rs/env_logger/latest/env_logger/index.html#enabling-logging for more information.",
styles = HELP_STYLES
)]
pub struct CopierArgs {
#[command(flatten)]
Expand Down
11 changes: 10 additions & 1 deletion mbtiles/src/bin/mbtiles.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::path::{Path, PathBuf};

use clap::builder::{Styles, styling::AnsiColor};
use clap::{Parser, Subcommand};
use log::error;
use mbtiles::{
Expand All @@ -8,12 +9,20 @@ use mbtiles::{
};
use tilejson::Bounds;

/// Defines the styles used for the CLI help output.
const HELP_STYLES: Styles = Styles::styled()
.header(AnsiColor::Blue.on_default().bold())
.usage(AnsiColor::Blue.on_default().bold())
.literal(AnsiColor::White.on_default())
.placeholder(AnsiColor::Green.on_default());

#[derive(Parser, PartialEq, Debug)]
#[command(
version,
name = "mbtiles",
about = "A utility to work with .mbtiles file content",
after_help = "Use RUST_LOG environment variable to control logging level, e.g. RUST_LOG=debug or RUST_LOG=mbtiles=debug. See https://docs.rs/env_logger/latest/env_logger/index.html#enabling-logging for more information."
after_help = "Use RUST_LOG environment variable to control logging level, e.g. RUST_LOG=debug or RUST_LOG=mbtiles=debug. See https://docs.rs/env_logger/latest/env_logger/index.html#enabling-logging for more information.",
styles = HELP_STYLES
)]
pub struct Args {
/// Display detailed information
Expand Down
Loading