structopt's maintainers have deprecated it in favour of clap.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
"memchr",
]
-[[package]]
-name = "ansi_term"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
-dependencies = [
- "winapi",
-]
-
[[package]]
name = "atty"
version = "0.2.14"
[[package]]
name = "clap"
-version = "2.34.0"
+version = "3.2.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
+checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5"
dependencies = [
- "ansi_term",
"atty",
"bitflags",
+ "clap_derive",
+ "clap_lex",
+ "indexmap",
+ "once_cell",
"strsim",
+ "termcolor",
"textwrap",
- "unicode-width",
- "vec_map",
+]
+
+[[package]]
+name = "clap_derive"
+version = "3.2.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65"
+dependencies = [
+ "heck",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "clap_lex"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
+dependencies = [
+ "os_str_bytes",
]
[[package]]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
-[[package]]
-name = "heck"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
-dependencies = [
- "unicode-segmentation",
-]
-
[[package]]
name = "heck"
version = "0.4.0"
dependencies = [
"backtrace",
"base64",
+ "clap",
"educe",
"either",
"env_logger",
"eyre",
"fehler",
"futures",
- "heck 0.4.0",
+ "heck",
"hippotat-macros",
"hyper",
"hyper-tls",
"pin-project-lite",
"regex",
"sha2",
- "structopt",
"subtle",
"syslog",
"thiserror",
"vcpkg",
]
+[[package]]
+name = "os_str_bytes"
+version = "6.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
+
[[package]]
name = "parking_lot"
version = "0.12.1"
[[package]]
name = "strsim"
-version = "0.8.0"
+version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
-
-[[package]]
-name = "structopt"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10"
-dependencies = [
- "clap",
- "lazy_static",
- "structopt-derive",
-]
-
-[[package]]
-name = "structopt-derive"
-version = "0.4.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
-dependencies = [
- "heck 0.3.3",
- "proc-macro-error",
- "proc-macro2",
- "quote",
- "syn",
-]
+checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "subtle"
[[package]]
name = "textwrap"
-version = "0.11.0"
+version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
-dependencies = [
- "unicode-width",
-]
+checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
[[package]]
name = "thiserror"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd"
-[[package]]
-name = "unicode-segmentation"
-version = "1.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a"
-
-[[package]]
-name = "unicode-width"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
-
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
-[[package]]
-name = "vec_map"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
-
[[package]]
name = "version_check"
version = "0.9.4"
# (or currently available):
backtrace = "0.3"
base64 = "0.13"
+clap = { version = "3", features = ["derive"] }
educe = "0.4"
either = "1"
env_logger = "0.9"
nix = "0.25"
pin-project-lite = "0.2"
sha2 = "0.10"
-structopt = "0.3"
subtle = "2"
syslog = "6"
tokio = { version = "1", features = ["full"] }
use hippotat::prelude::*;
use hippotat_macros::into_crlfs;
-#[derive(StructOpt,Debug)]
+#[derive(clap::Parser,Debug)]
pub struct Opts {
- #[structopt(flatten)]
+ #[clap(flatten)]
log: LogOpts,
- #[structopt(flatten)]
+ #[clap(flatten)]
config: config::Opts,
}
#[tokio::main]
async fn main() {
- let opts = Opts::from_args();
+ let opts = <Opts as clap::Parser>::parse();
let (ics,) = config::startup("hippotat", LinkEnd::Client,
&opts.config, &opts.log, |ics|Ok((ics,)));
pub use sweb::{WebRequest, WebResponse, WebResponseBody};
pub use suser::User;
-#[derive(StructOpt,Debug)]
+#[derive(clap::Parser,Debug)]
pub struct Opts {
- #[structopt(flatten)]
+ #[clap(flatten)]
pub log: LogOpts,
- #[structopt(flatten)]
+ #[clap(flatten)]
pub config: config::Opts,
/// Daemonise
- #[structopt(long)]
+ #[clap(long)]
daemon: bool,
/// Write our pid to this file
- #[structopt(long)]
+ #[clap(long)]
pidfile: Option<String>,
/// Print a config item, do not actually run
- #[structopt(long)]
+ #[clap(long)]
print_config: Option<String>,
}
}
fn main() {
- let opts = Opts::from_args();
+ let opts = <Opts as clap::Parser>::parse();
let daemon = if opts.daemon && opts.print_config.is_none() {
Some(Daemoniser::phase1())
target_requests_outstanding = 10
"#;
-#[derive(StructOpt,Debug)]
+#[derive(clap::Args,Debug)]
pub struct Opts {
/// Top-level config file or directory
///
/// Look for `main.cfg`, `config.d` and `secrets.d` here.
///
/// Or if this is a file, just read that file.
- #[structopt(long, default_value="/etc/hippotat")]
+ #[clap(long, default_value="/etc/hippotat")]
pub config: PathBuf,
/// Additional config files or dirs, which can override the others
- #[structopt(long, multiple=true, number_of_values=1)]
+ #[clap(long, multiple=true, number_of_values=1)]
pub extra_config: Vec<PathBuf>,
}
pub use log::{trace, debug, info, warn, error};
pub use memchr::memmem;
pub use pin_project_lite::pin_project;
-pub use structopt::StructOpt;
pub use subtle::ConstantTimeEq;
pub use thiserror::Error;
pub use tokio::io::{AsyncBufReadExt, AsyncWriteExt};
use crate::prelude::*;
-#[derive(StructOpt,Debug)]
+#[derive(clap::Parser,Debug)]
pub struct LogOpts {
/// Increase debug level
///
/// and two -`D` means to send to syslog even messages from lower layers
/// (normally just the hippotat modules log to
/// syslog).
- #[structopt(long, short="D", parse(from_occurrences))]
+ #[clap(long, short='D', parse(from_occurrences))]
debug: usize,
/// Syslog facility to use
- #[structopt(long, parse(try_from_str=parse_syslog_facility))]
+ #[clap(long, parse(try_from_str=parse_syslog_facility))]
syslog_facility: Option<syslog::Facility>,
}