From 7532610be8a86154dceeb7c600cd9a6f16c20dc5 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 30 Nov 2022 13:15:36 -0800 Subject: [PATCH] Fix examples in docs (#201) * Add stellar-xdr bin * Expose all versions of xdr * Update CLI to use multiple channels * fmt * Use makefile in tests * simplify build * undo * fix version * update readme * fix docs * fix * fix docs * fix doc * simplify example * fix * fix --- README.md | 18 +++++++++++------- src/lib.rs | 12 ++++++++---- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e60a81ff..af68e186 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ and is receiving breaking changes frequently.** To use the library, include in your toml: ```toml -stellar-xdr = { version = "...", default-features = true, features = [...] } +stellar-xdr = { version = "...", default-features = true, features = [] } ``` ##### Features @@ -66,24 +66,28 @@ the root of the crate. To use the CLI: -```toml +```console cargo install --locked stellar-xdr --version ... --features cli ``` ##### Examples Parse a `TransactionEnvelope`: -```rust -echo -n 'AAAAA...' | stellar-xdr decode --type TransactionEnvelope +```console +stellar-xdr decode --type TransactionEnvelope << - +AAAAA... +- ``` Parse a `ScSpecEntry` stream from a contract: -```rust -echo -n 'AAAAA...' | stellar-xdr +next decode --type ScSpecEntry --input stream-base64 --output json-formatted +```console +stellar-xdr +next decode --type ScSpecEntry --input stream-base64 --output json-formatted << - +AAAAA... +- ``` Parse a `BucketEntry` framed stream from a bucket file: -```rust +```console stellar-xdr decode --type BucketEntry --input stream-framed --output json-formatted bucket.xdr ``` diff --git a/src/lib.rs b/src/lib.rs index 723f3bb1..6d905d0c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,7 +21,7 @@ //! To use the library, include in your toml: //! //! ```toml -//! stellar-xdr = { version = "...", default-features = true, features = [...] } +//! stellar-xdr = { version = "...", default-features = true, features = [] } //! ``` //! //! #### Features @@ -68,7 +68,7 @@ //! //! To use the CLI: //! -//! ```toml +//! ```console //! cargo install --locked stellar-xdr --version ... --features cli //! ``` //! @@ -76,12 +76,16 @@ //! //! Parse a `TransactionEnvelope`: //! ```console -//! echo -n 'AAAAA...' | stellar-xdr decode --type TransactionEnvelope +//! stellar-xdr decode --type TransactionEnvelope << - +//! AAAAA... +//! - //! ``` //! //! Parse a `ScSpecEntry` stream from a contract: //! ```console -//! echo -n 'AAAAA...' | stellar-xdr +next decode --type ScSpecEntry --input stream-base64 --output json-formatted +//! stellar-xdr +next decode --type ScSpecEntry --input stream-base64 --output json-formatted << - +//! AAAAA... +//! - //! ``` //! //! Parse a `BucketEntry` framed stream from a bucket file: