diff --git a/docs/guide/completions.md b/docs/guide/completions.md index efecf40..f325b91 100644 --- a/docs/guide/completions.md +++ b/docs/guide/completions.md @@ -1,3 +1,30 @@ + +
+ +[Previous](previous) +[Up](super) +[Next]() + +
+ # Completions Shell completions and documentation can be generated automatically by this crate. The implementation for this is in the [`uutils-args-complete`] crate. The easiest way of generating completions is via the `parse-is-complete` feature flag. This feature flag hijacks the [`Options::parse`](crate::Options::parse) function to print completions. This means that there is usually no need to write any additional code to generate completions. @@ -13,3 +40,11 @@ The `[shell]` value here can be `fish`, `zsh`, `bash`, `powershell`, `elvish` or Additionally, the values `man` or `md` can be passed to generate man pages and markdown documentation (for `mdbook`). If you do not want to hijack the [`Options::parse`](crate::Options::parse) function, you can instead enable the `complete` feature flag. This makes the `Options::complete` function available in addition to the [`Options::parse`](crate::Options::parse) function to generate a `String` with the completion. + +
+ +[Previous](previous) +[Up](super) +[Next]() + +
\ No newline at end of file diff --git a/docs/guide/port.md b/docs/guide/port.md index a154a10..2cc2981 100644 --- a/docs/guide/port.md +++ b/docs/guide/port.md @@ -1,3 +1,30 @@ + +
+ +[Previous](previous) +[Up](super) +[Next](next) + +
+ # Porting from Clap This chapter contains information about how common patterns in `clap` parsers can be ported to `uutils-args`. @@ -237,3 +264,11 @@ impl Options for Settings { let a = Settings::default().parse(std::env::args_os()).0.a; ``` + +
+ +[Previous](previous) +[Up](super) +[Next](next) + +
\ No newline at end of file diff --git a/docs/guide/quick.md b/docs/guide/quick.md index 2a150b9..6b928ea 100644 --- a/docs/guide/quick.md +++ b/docs/guide/quick.md @@ -1,3 +1,31 @@ + +
+ +[Previous]() +[Up](super) +[Next](next) + +
+ # Quick Start A parser consists of two parts: @@ -253,3 +281,11 @@ enum Arg { # assert_eq!(Settings::default().parse(["test", "--sort=time"]).0.sort, String::from("time")); # assert_eq!(Settings::default().parse(["test", "-t"]).0.sort, String::from("time")); ``` + +
+ +[Previous]() +[Up](super) +[Next](next) + +
\ No newline at end of file diff --git a/docs/guide/value.md b/docs/guide/value.md index 7cbff6e..443a960 100644 --- a/docs/guide/value.md +++ b/docs/guide/value.md @@ -1,3 +1,30 @@ + +
+ +[Previous](previous) +[Up](super) +[Next](next) + +
+ # Value trait Any field on the enum implementing [`Arguments`](trait@crate::Arguments) has to implement the [`Value`](trait@crate::Value) trait, which determines how it is derive from the text value. Normally, [`Value`](trait@crate::Value) only requires one method: [`from_value`](crate::Value::from_value), which takes an `&OsStr` and returns a `Result` with either `Self` or some boxed error. @@ -55,3 +82,11 @@ assert_eq!(Color::from_value(&OsStr::new("never")).unwrap(), Color::Never); assert!(Color::from_value(&OsStr::new("a")).is_err()); assert_eq!(Color::from_value(&OsStr::new("n")).unwrap(), Color::Never); ``` + +
+ +[Previous](previous) +[Up](super) +[Next](next) + +
\ No newline at end of file diff --git a/src/docs.rs b/src/docs.rs index 3168ade..7e12bd9 100644 --- a/src/docs.rs +++ b/src/docs.rs @@ -5,14 +5,24 @@ #[doc = include_str!("../docs/guide/guide.md")] pub mod guide { - #[doc = include_str!("../docs/guide/quick.md")] - pub mod quick {} - #[doc = include_str!("../docs/guide/port.md")] - pub mod port {} - #[doc = include_str!("../docs/guide/completions.md")] - pub mod completions {} - #[doc = include_str!("../docs/guide/value.md")] - pub mod value {} + pub mod quick { + #![doc = include_str!("../docs/guide/quick.md")] + pub use super::port as next; + } + pub mod port { + #![doc = include_str!("../docs/guide/port.md")] + pub use super::quick as previous; + pub use super::value as next; + } + pub mod value { + #![doc = include_str!("../docs/guide/value.md")] + pub use super::port as previous; + pub use super::completions as next; + } + pub mod completions { + #![doc = include_str!("../docs/guide/completions.md")] + pub use super::value as previous; + } } #[doc = include_str!("../docs/design/design.md")]