From fd6191e9e3d804db807531ba49df2b4135338a5e Mon Sep 17 00:00:00 2001 From: Jonathan Strong Date: Thu, 8 Sep 2022 22:56:00 -0400 Subject: [PATCH] adds Example Usage section --- Cargo.lock | 2 +- README.md | 27 ++++++++++++++++++++++++--- doc/README.tera.md | 21 +++++++++++++++++++++ doc/cli-menu.txt | 4 ++-- justfile | 2 +- 5 files changed, 49 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6e71089..e9c6763 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1310,7 +1310,7 @@ checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "registry-backup" -version = "0.2.2" +version = "0.2.3" dependencies = [ "chrono", "clap", diff --git a/README.md b/README.md index 53772e5..b0f178a 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,33 @@ Use cases: - **Backup:** retrieve a registry server's files for backup storage - **Export:** pull the files so you can host them at another registry server +## Example Usage: + +Specify the registry index either as a local path (`--index-path`)... + +```console +$ git clone https://github.com/rust-lang/crates.io-index.git +$ registry-backup \ + --index-path crates.io-index \ + --output-path crates.io-crate-files \ + --requests-per-second 10 +``` + +...or as an `--index-url` instead: + +```console +$ registry-backup \ + --index-url ssh://git@ssh.shipyard.rs/shipyard-rs/crate-index.git \ + --output-path shipyard-rs-crate-files \ + --requests-per-second 10 +``` + ## Runtime Options ```console $ ./target/release/registry-backup --help -registry-backup 0.2.2 +registry-backup 0.2.3 Jonathan Strong Download all .crate files from a registry server @@ -32,7 +53,7 @@ OPTIONS: Directory where downloaded .crate files will be saved to [default: output] -u, --user-agent - Value of user-agent HTTP header [default: registry-backup/v0.2.2] + Value of user-agent HTTP header [default: registry-backup/v0.2.3] --requests-per-second Requests to registry server will not exceed this rate [default: 25] @@ -116,7 +137,7 @@ The commands that mirror cargo commands (e.g. `just test`) are included for the This file is generated using a template (`doc/README.tera.md`) rendered using updated outputs of the CLI menu, config sample, and other values. -This version of `README.md` was generated at `Fri, 09 Sep 2022 02:45:35 +0000` based on git commit `67814b8a`. +This version of `README.md` was generated at `Fri, 09 Sep 2022 02:55:22 +0000` based on git commit `1c087e79`. To (re-)generate the `README.md` file, use the justfile command: diff --git a/doc/README.tera.md b/doc/README.tera.md index a097f88..fc58595 100644 --- a/doc/README.tera.md +++ b/doc/README.tera.md @@ -7,6 +7,27 @@ Use cases: - **Backup:** retrieve a registry server's files for backup storage - **Export:** pull the files so you can host them at another registry server +## Example Usage: + +Specify the registry index either as a local path (`--index-path`)... + +```console +$ git clone https://github.com/rust-lang/crates.io-index.git +$ registry-backup \ + --index-path crates.io-index \ + --output-path crates.io-crate-files \ + --requests-per-second 10 +``` + +...or as an `--index-url` instead: + +```console +$ registry-backup \ + --index-url ssh://git@ssh.shipyard.rs/shipyard-rs/crate-index.git \ + --output-path shipyard-rs-crate-files \ + --requests-per-second 10 +``` + ## Runtime Options ```console diff --git a/doc/cli-menu.txt b/doc/cli-menu.txt index d24f37c..4bd739b 100644 --- a/doc/cli-menu.txt +++ b/doc/cli-menu.txt @@ -1,4 +1,4 @@ -registry-backup 0.2.2 +registry-backup 0.2.3 Jonathan Strong Download all .crate files from a registry server @@ -18,7 +18,7 @@ OPTIONS: Directory where downloaded .crate files will be saved to [default: output] -u, --user-agent - Value of user-agent HTTP header [default: registry-backup/v0.2.2] + Value of user-agent HTTP header [default: registry-backup/v0.2.3] --requests-per-second Requests to registry server will not exceed this rate [default: 25] diff --git a/justfile b/justfile index c18465a..7939000 100644 --- a/justfile +++ b/justfile @@ -47,7 +47,7 @@ get-crate-version: @cat Cargo.toml | rg '^version =' | tr -d "version = " | tr -d '"' # re-generate README.md and overwrite existing file with output -update-readme: verify-clean-git +update-readme: just generate-readme > README.md # re-generate, overwrite, and stage changes