Crate json_arg

Source
Expand description

CLIs (especially those designed to be called by automation) often take structured data as inputs. This ends up creating a ton of boilerplate where a CLI arg is declared as a PathBuf and then is quickly opened, read from and deserialized with some serde format crate. This crate provides two newtype wrappers (Serde and SerdeFile) that can deserialize any Serde-compatible arguments with no extra effort.

Structs§

JsonFormat
Deserialize the argument as JSON
Serde
Inline JSON string. The argument provided by the caller is the raw JSON string (and the caller must consequently deal with shell quoting ahead-of-time).
SerdeFile
Argument that represents a serialized file. The argument provided by the caller is the path to the file that is deserialized immediately on load. The original path is preserved and accessible with SerdeFile::path
TomlFormat
Deserialize the argument as TOML

Traits§

DeserializeReader

Type Aliases§

Json
JsonFile
Toml
TomlFile