mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 14:52:33 +00:00
commit
b73c7e8518
3 changed files with 29 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
||||||
// Std
|
// Std
|
||||||
use std::ffi::{OsStr, OsString};
|
use std::ffi::{OsStr, OsString};
|
||||||
use std::io::{self, BufWriter, Write};
|
use std::io::{self, BufWriter, Write};
|
||||||
#[cfg(feature = "debug")]
|
#[cfg(all(feature = "debug", not(target_arch = "wasm32")))]
|
||||||
use std::os::unix::ffi::OsStrExt;
|
use std::os::unix::ffi::OsStrExt;
|
||||||
use std::slice::Iter;
|
use std::slice::Iter;
|
||||||
use std::iter::Peekable;
|
use std::iter::Peekable;
|
||||||
|
|
|
@ -4,9 +4,9 @@ use std::rc::Rc;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt::{self, Display, Formatter};
|
use std::fmt::{self, Display, Formatter};
|
||||||
use std::ffi::{OsStr, OsString};
|
use std::ffi::{OsStr, OsString};
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(any(target_os = "windows", target_arch = "wasm32"))]
|
||||||
use osstringext::OsStrExt3;
|
use osstringext::OsStrExt3;
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(any(target_os = "windows", target_arch = "wasm32")))]
|
||||||
use std::os::unix::ffi::OsStrExt;
|
use std::os::unix::ffi::OsStrExt;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::cmp::{Ord, Ordering};
|
use std::cmp::{Ord, Ordering};
|
||||||
|
@ -3746,6 +3746,29 @@ impl<'a, 'b> Arg<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Indicates that all parameters passed after this should not be parsed
|
||||||
|
/// individually, but rather passed in their entirety. It is worth noting
|
||||||
|
/// that setting this requires all values to come after a `--` to indicate they
|
||||||
|
/// should all be captured. For example:
|
||||||
|
///
|
||||||
|
/// ```notrust
|
||||||
|
/// --foo something -- -v -v -v -b -b -b --baz -q -u -x
|
||||||
|
/// ```
|
||||||
|
/// Will result in everything after `--` to be considered one raw argument. This behavior
|
||||||
|
/// may not be exactly what you are expecting and using [`AppSettings::TrailingVarArg`]
|
||||||
|
/// may be more appropriate.
|
||||||
|
///
|
||||||
|
/// **NOTE:** Implicitly sets [`Arg::multiple(true)`], [`Arg::allow_hyphen_values(true)`], and
|
||||||
|
/// [`Arg::last(true)`] when set to `true`
|
||||||
|
///
|
||||||
|
/// [`Arg::multiple(true)`]: ./struct.Arg.html#method.multiple
|
||||||
|
/// [`Arg::allow_hyphen_values(true)`]: ./struct.Arg.html#method.allow_hyphen_values
|
||||||
|
/// [`Arg::last(true)`]: ./struct.Arg.html#method.last
|
||||||
|
/// [`AppSettings::TrailingVarArg`]: ./enum.AppSettings.html#variant.TrailingVarArg
|
||||||
|
pub fn raw(self, raw: bool) -> Self {
|
||||||
|
self.multiple(raw).allow_hyphen_values(raw).last(raw)
|
||||||
|
}
|
||||||
|
|
||||||
// @TODO @docs @v3-beta: write better docs as ArgSettings is now critical
|
// @TODO @docs @v3-beta: write better docs as ArgSettings is now critical
|
||||||
/// Checks if one of the [`ArgSettings`] is set for the argument
|
/// Checks if one of the [`ArgSettings`] is set for the argument
|
||||||
/// [`ArgSettings`]: ./enum.ArgSettings.html
|
/// [`ArgSettings`]: ./enum.ArgSettings.html
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(any(target_os = "windows", target_arch = "wasm32"))]
|
||||||
use INVALID_UTF8;
|
use INVALID_UTF8;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(any(target_os = "windows", target_arch = "wasm32")))]
|
||||||
use std::os::unix::ffi::OsStrExt;
|
use std::os::unix::ffi::OsStrExt;
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(any(target_os = "windows", target_arch = "wasm32"))]
|
||||||
pub trait OsStrExt3 {
|
pub trait OsStrExt3 {
|
||||||
fn from_bytes(b: &[u8]) -> &Self;
|
fn from_bytes(b: &[u8]) -> &Self;
|
||||||
fn as_bytes(&self) -> &[u8];
|
fn as_bytes(&self) -> &[u8];
|
||||||
|
|
Loading…
Reference in a new issue