Skip to content

Commit

Permalink
release: 0.6.7
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Feb 8, 2023
2 parents 6138268 + 3fd4a89 commit 86943c6
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@



## [0.6.7](https://github.com/Blobfolio/argyle/releases/tag/v0.6.7) - 2023-02-07

### Changed

* Rename `Argue::option2_iter` to `Argue::option2_values`
* Rename `Argue::option2_iter_os` to `Argue::option2_values_os`



## [0.6.6](https://github.com/Blobfolio/argyle/releases/tag/v0.6.6) - 2023-02-04

### Changed
Expand Down
4 changes: 2 additions & 2 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Project Dependencies
Package: argyle
Version: 0.6.6
Generated: 2023-02-05 04:49:01 UTC
Version: 0.6.7
Generated: 2023-02-08 04:34:24 UTC

This package has no dependencies.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "argyle"
version = "0.6.6"
version = "0.6.7"
authors = ["Blobfolio, LLC. <[email protected]>"]
edition = "2021"
rust-version = "1.62"
Expand Down
12 changes: 6 additions & 6 deletions src/argue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ impl Argue {
/// you would use this for a flag that has both a long and short version.
///
/// This will only ever match the _last_ occurrence. For options that
/// may be specified more than once, use [`Argue::option2_iter`] instead.
/// may be specified more than once, use [`Argue::option2_values`] instead.
///
/// ## Examples
///
Expand Down Expand Up @@ -710,11 +710,11 @@ impl Argue {
/// use argyle::Argue;
///
/// let mut args = Argue::new(0).unwrap();
/// for v in args.option2_iter(b"-o", b"--my-opt", None) {
/// for v in args.option2_values(b"-o", b"--my-opt", None) {
/// println!("{:?}", std::str::from_utf8(v));
/// }
/// ```
pub fn option2_iter<'a>(&'a self, short: &'a [u8], long: &'a [u8], delimiter: Option<u8>)
pub fn option2_values<'a>(&'a self, short: &'a [u8], long: &'a [u8], delimiter: Option<u8>)
-> Options<'a> {
if let Some(idx) = self.args.iter().rposition(|x| x == short || x == long) {
let idx = idx + 1;
Expand Down Expand Up @@ -891,11 +891,11 @@ impl Argue {

/// # Option 2x Value(s) Iterator.
///
/// This works just like [`Argue::option2_iter`], except it returns the value
/// This works just like [`Argue::option2_values`], except it returns the value
/// as an [`OsStr`](std::ffi::OsStr) instead of bytes.
pub fn option2_iter_os<'a>(&'a self, short: &'a [u8], long: &'a [u8], delimiter: Option<u8>)
pub fn option2_values_os<'a>(&'a self, short: &'a [u8], long: &'a [u8], delimiter: Option<u8>)
-> OptionsOsStr<'a> {
OptionsOsStr(self.option2_iter(short, long, delimiter))
OptionsOsStr(self.option2_values(short, long, delimiter))
}

#[must_use]
Expand Down
12 changes: 6 additions & 6 deletions src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<'a> ArgsOsStr<'a> {
/// This iterator yields the value(s) corresponding to a given option, useful
/// for commands that accept the same argument multiple times.
///
/// It is the return value for [`Argue::option_values`](crate::Argue::option_values) and [`Argue::option2_iter`](crate::Argue::option2_iter).
/// It is the return value for [`Argue::option_values`](crate::Argue::option_values) and [`Argue::option2_values`](crate::Argue::option2_values).
pub struct Options<'a> {
buf: Vec<&'a [u8]>,
inner: &'a [Vec<u8>],
Expand Down Expand Up @@ -130,7 +130,7 @@ impl<'a> Options<'a> {
/// This iterator yields the value(s) corresponding to a given option, useful
/// for commands that accept the same argument multiple times.
///
/// It is the return value for [`Argue::option_values_os`](crate::Argue::option_values_os) and [`Argue::option2_iter_os`](crate::Argue::option2_iter_os).
/// It is the return value for [`Argue::option_values_os`](crate::Argue::option_values_os) and [`Argue::option2_values_os`](crate::Argue::option2_values_os).
pub struct OptionsOsStr<'a>(pub(crate) Options<'a>);

impl<'a> Iterator for OptionsOsStr<'a> {
Expand Down Expand Up @@ -173,12 +173,12 @@ mod tests {
);

assert_eq!(
args.option2_iter(b"-k", b"--key", None).collect::<Vec<&[u8]>>(),
args.option2_values(b"-k", b"--key", None).collect::<Vec<&[u8]>>(),
[&b"Val"[..], b"hello,world", b"nice"],
);

assert_eq!(
args.option2_iter(b"-k", b"--key", Some(b',')).collect::<Vec<&[u8]>>(),
args.option2_values(b"-k", b"--key", Some(b',')).collect::<Vec<&[u8]>>(),
[&b"Val"[..], b"hello", b"world", b"nice"],
);
}
Expand Down Expand Up @@ -206,12 +206,12 @@ mod tests {
);

assert_eq!(
args.option2_iter_os(b"-k", b"--key", None).collect::<Vec<&OsStr>>(),
args.option2_values_os(b"-k", b"--key", None).collect::<Vec<&OsStr>>(),
[OsStr::new("Val"), OsStr::new("hello,world"), OsStr::new("nice")],
);

assert_eq!(
args.option2_iter_os(b"-k", b"--key", Some(b',')).collect::<Vec<&OsStr>>(),
args.option2_values_os(b"-k", b"--key", Some(b',')).collect::<Vec<&OsStr>>(),
[OsStr::new("Val"), OsStr::new("hello"), OsStr::new("world"), OsStr::new("nice")],
);
}
Expand Down

0 comments on commit 86943c6

Please sign in to comment.