Skip to content

Commit

Permalink
fix(doc): Fix doctests, bump version numbers, add myself as author
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsastrix committed Jun 28, 2022
1 parent 3432adc commit ea8ac02
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
6 changes: 3 additions & 3 deletions libuci-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "libuci-sys"
version = "1.0.5"
authors = ["Benjamin Ludewig <[email protected]>"]
version = "1.1.0"
authors = ["Benjamin Ludewig <[email protected]>", "Hugo Hakim Damer <[email protected]>"]
description = "FFI bindings to OpenWRT UCI"
license = "MIT OR Apache-2.0"
repository = "https://github.com/namib-project/libuci-sys"
Expand All @@ -16,4 +16,4 @@ targets = ["x86_64-unknown-linux-gnu"]

[build-dependencies]
bindgen = "^0.58.1"
cmake = "^0.1.45"
cmake = "^0.1.45"
8 changes: 4 additions & 4 deletions rust-uci/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rust-uci"
version = "0.1.5"
authors = ["Benjamin Ludewig <[email protected]>"]
version = "0.1.6"
authors = ["Benjamin Ludewig <[email protected]>", "Hugo Hakim Damer <[email protected]>"]
description = "OpenWRT UCI rust bindings"
repository = "https://github.com/namib-project/libuci-sys"
keywords = ["openwrt"]
Expand All @@ -13,6 +13,6 @@ edition = "2018"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
libuci-sys = { version = "1.0.5", path = "../libuci-sys" }
libuci-sys = { version = "^1.1.0", path = "../libuci-sys" }
log = "^0.4.14"
libc = "^0.2.91"
libc = "^0.2.91"
27 changes: 14 additions & 13 deletions rust-uci/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,25 @@
//! ```no_run
//! use rust_uci::Uci;
//!
//! let mut uci = Uci::new()?;
//! let mut uci = Uci::new().expect("unable to create UCI context");
//! // Get type of a section
//! assert_eq!(uci.get("network.wan")?, "interface");
//! assert_eq!(uci.get("network.wan").expect("unable to get value for network.wan"), "interface");
//! // Get value of an option, UCI's extended syntax is supported
//! assert_eq!(uci.get("network.@interface[0].proto")?, "static");
//! assert_eq!(uci.get("network.lan.proto")?, "static");
//! assert_eq!(uci.get("network.@interface[0].proto").expect("unable to get value for network.@interface[0].proto"), "static");
//! assert_eq!(uci.get("network.lan.proto").expect("unable to get value for network.lan.proto"), "static");
//!
//! // Create a new section
//! uci.set("network.newnet", "interface")?;
//! uci.set("network.newnet.proto", "static")?;
//! uci.set("network.newnet.ifname", "en0")?;
//! uci.set("network.newnet.enabled", "1")?;
//! uci.set("network.newnet.ipaddr", "2.3.4.5")?;
//! uci.set("network.newnet.test", "123")?;
//! uci.delete("network.newnet.test")?;
//! uci.set("network.newnet", "interface").expect("unable to set network.newnet");
//! uci.set("network.newnet.proto", "static").expect("unable to set network.newnet.proto");
//! uci.set("network.newnet.ifname", "en0").expect("unable to set network.newnet.ifname");
//! uci.set("network.newnet.enabled", "1").expect("unable to set network.newnet.enabled");
//! uci.set("network.newnet.ipaddr", "2.3.4.5").expect("unable to set network.newnet.ipaddr");
//! uci.set("network.newnet.test", "123").expect("unable to set network.newnet.test");
//! // Delete option
//! uci.delete("network.newnet.test").expect("unable to delete network.newnet.test");
//! // IMPORTANT: Commit or revert the changes
//! uci.commit("network")?;
//! uci.revert("network")?;
//! uci.commit("network").expect("unable to commit changes");
//! uci.revert("network").expect("unable to revert changes");
//!
//! ```
Expand Down

0 comments on commit ea8ac02

Please sign in to comment.