mirror of
https://github.com/clap-rs/clap
synced 2024-09-20 14:31:58 +00:00
chore: move to 2018 edition
This commit is contained in:
parent
df8aa6b2ee
commit
1498910971
14 changed files with 34 additions and 11 deletions
|
@ -38,6 +38,7 @@ categories = ["command-line-interface"]
|
|||
description = """
|
||||
A simple to use, efficient, and full featured Command Line Argument Parser
|
||||
"""
|
||||
edition = "2018"
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "clap-rs/clap" }
|
||||
|
|
13
src/build/arg/key/position.rs
Normal file
13
src/build/arg/key/position.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
pub struct Position(u64);
|
||||
|
||||
impl Default for Position {
|
||||
fn default() -> Self {
|
||||
Position(1)
|
||||
}
|
||||
}
|
||||
|
||||
impl Position {
|
||||
fn new() -> Self {
|
||||
Position(1)
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
pub struct Position {
|
||||
index: u64
|
||||
}
|
|
@ -1,13 +1,14 @@
|
|||
pub struct DefaultValue<'help> {
|
||||
value: &'help str,
|
||||
pub struct EnvDefaultValue<'help> {
|
||||
key: &'help OsStr,
|
||||
value: Option<OsString>
|
||||
}
|
||||
|
||||
pub struct ConditionalDefault<'help> {
|
||||
value: DefaultValue<'help>,
|
||||
value: &'help str,
|
||||
other_arg: Option<u64>,
|
||||
other_value: Option<&'help str>,
|
||||
}
|
||||
|
||||
pub struct DefaultValues<'help> {
|
||||
defaults: Vec<ConditionalDefault<'help>>,
|
||||
env: Option<EnvDefaultValue<'help>>,
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
pub struct Value<'help> {
|
||||
defaults: Option<DefaultValues>,
|
||||
name: Option<&'help str>,
|
||||
filter: Filter,
|
||||
occurrence: Occurrence,
|
||||
requires_equals: bool,
|
15
src/build/arg/value/value_name.rs
Normal file
15
src/build/arg/value/value_name.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
use std::io;
|
||||
|
||||
pub struct ValueName<'help>(&'help str);
|
||||
|
||||
impl<'help> ValueName<'help> {
|
||||
fn write_as_required<W: io::Write>(&self, w: W) -> io::Result {
|
||||
write!(w, "<{}>", self.0)
|
||||
}
|
||||
fn write_as_optional<W: io::Write>(&self, w: W) -> io::Result {
|
||||
write!(w, "[{}]", self.0)
|
||||
}
|
||||
fn write<W: io::Write>(&self, w: W) -> io::Result {
|
||||
write!(w, "{}", self.0)
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
pub struct ValueName<'help> {
|
||||
name: &'help str,
|
||||
}
|
Loading…
Reference in a new issue