mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
parent
547665d52a
commit
de7c81e059
1 changed files with 34 additions and 13 deletions
|
@ -48,20 +48,41 @@ pub enum AppSettings {
|
||||||
/// ```
|
/// ```
|
||||||
IgnoreErrors,
|
IgnoreErrors,
|
||||||
|
|
||||||
/// Display the message "Press \[ENTER\]/\[RETURN\] to continue..." and wait for user before
|
/// Deprecated, replace
|
||||||
/// exiting
|
/// ```rust,no_run
|
||||||
///
|
/// let app = clap::App::new("app")
|
||||||
/// This is most useful when writing an application which is run from a GUI shortcut, or on
|
/// .global_setting(clap::AppSettings::WaitOnError)
|
||||||
/// Windows where a user tries to open the binary by double-clicking instead of using the
|
/// .arg(clap::arg!(--flag));
|
||||||
/// command line.
|
/// let m = app.get_matches();
|
||||||
///
|
|
||||||
/// # Examples
|
|
||||||
///
|
|
||||||
/// ```rust
|
|
||||||
/// # use clap::{App, Arg, AppSettings};
|
|
||||||
/// App::new("myprog")
|
|
||||||
/// .global_setting(AppSettings::WaitOnError);
|
|
||||||
/// ```
|
/// ```
|
||||||
|
/// with
|
||||||
|
/// ```rust
|
||||||
|
/// let app = clap::App::new("app")
|
||||||
|
/// .arg(clap::arg!(--flag));
|
||||||
|
/// let m = match app.try_get_matches() {
|
||||||
|
/// Ok(m) => m,
|
||||||
|
/// Err(err) => {
|
||||||
|
/// if err.use_stderr() {
|
||||||
|
/// let _ = err.print();
|
||||||
|
///
|
||||||
|
/// eprintln!("\nPress [ENTER] / [RETURN] to continue...");
|
||||||
|
/// use std::io::BufRead;
|
||||||
|
/// let mut s = String::new();
|
||||||
|
/// let i = std::io::stdin();
|
||||||
|
/// i.lock().read_line(&mut s).unwrap();
|
||||||
|
///
|
||||||
|
/// std::process::exit(2);
|
||||||
|
/// } else {
|
||||||
|
/// let _ = err.print();
|
||||||
|
/// std::process::exit(0);
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// };
|
||||||
|
/// ```
|
||||||
|
#[deprecated(
|
||||||
|
since = "3.1.0",
|
||||||
|
note = "See documentation for how to hand-implement this"
|
||||||
|
)]
|
||||||
WaitOnError,
|
WaitOnError,
|
||||||
|
|
||||||
/// Specifies that leading hyphens are allowed in all argument *values* (e.g. `-10`).
|
/// Specifies that leading hyphens are allowed in all argument *values* (e.g. `-10`).
|
||||||
|
|
Loading…
Reference in a new issue