From 4ec389b6ccfc7650be7489cd6747183c428d98bf Mon Sep 17 00:00:00 2001 From: grimhilt Date: Sun, 2 Jul 2023 15:51:51 +0200 Subject: [PATCH] improve documentation --- Cargo.lock | 19 ++++++++++++++++++- Cargo.toml | 1 + src/main.rs | 6 ++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 62e8a98..779e4f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -113,7 +113,7 @@ dependencies = [ "atty", "bitflags", "strsim", - "textwrap", + "textwrap 0.11.0", "unicode-width", "vec_map", ] @@ -588,6 +588,7 @@ dependencies = [ "regex", "reqwest", "rust-crypto", + "textwrap 0.13.4", "tokio", "xml-rs", ] @@ -976,6 +977,12 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "smawk" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" + [[package]] name = "socket2" version = "0.4.9" @@ -1025,6 +1032,16 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "textwrap" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd05616119e612a8041ef58f2b578906cc2531a6069047ae092cfb86a325d835" +dependencies = [ + "smawk", + "unicode-width", +] + [[package]] name = "time" version = "0.1.45" diff --git a/Cargo.toml b/Cargo.toml index 6e23fb3..53716c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ xml-rs = "0.8.0" regex = "1.8.3" lazy_static = "1.4.0" glob = "0.3.1" +textwrap = "0.13" chrono = "0.4.26" [profile.release] diff --git a/src/main.rs b/src/main.rs index fffbc86..016b2c6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ use clap::{App, Arg, SubCommand}; +use textwrap::{fill, Options}; use crate::commands::add::AddArgs; mod commands; @@ -20,6 +21,10 @@ fn main() { .required(true) .takes_value(true) .value_name("REMOTE") + .help(&fill( + "The repository to clone from. See the NEXTSYNC URLS section below for more information on specifying repositories.", + Options::new(80).width, + )) ) .arg( Arg::with_name("directory") @@ -28,6 +33,7 @@ fn main() { .value_name("DIRECTORY") ) .about("Clone a repository into a new directory") + .after_help("NEXTSYNC URLS\nThe following syntaxes may be used:\n\t- user@host.xz/path/to/repo\n\t- http[s]://host.xz/apps/files/?dir=/path/to/repo&fileid=111111\n\t- [http[s]://]host.xz/remote.php/dav/files/user/path/to/repo\n") ) .subcommand( SubCommand::with_name("init")