1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! This module contains command line parsing utilities.
//!
//! The primary use is to enable using the *structopt* crate in context of implementing a
//! custom cargo command. The specific challenge here is to close the gap between what
//! cargo passes as command line arguments to the custom command executable and what
//! *structopt* expects:
//!
//! * Running `cargo <foo>` looks for an executable named *cargo-\<foo\>*, and when
//! found calls *cargo-\<foo\>* passing *\<foo\>* as the second command line argument.
//! * *structopt* follows the established convention that the first command line argument
//! designates the executable name, with arguments starting from the second being passed
//! to that executable.
//!
//! The solution here is to implement an [`Iterator`] feeding *structopt* that addresses
//! both issues:
//!
//! * Convert the first command line argument *cargo-\<foo\>* into something that is
//! displayed as `cargo foo`.
//! * Skip over the second command line argument, that's always equal to `foo` when
//! invoked from cargo.
//!
use ;
/// A structure holding command line arguments.
///
/// This structure isn't useful in itself. It merely provides an [`Iterator`]
/// implementation to be used by *structopt*'s `from_iter()` or `from_iter_safe()`
/// methods.
///
pub