Skip to content

Commit d00e4ec

Browse files
committed
Change name of book variable
1 parent 2f9396b commit d00e4ec

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/cmd/shelf.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ pub fn execute(_args: &ArgMatches) -> Result<()> {
111111
writeln!(summary, "# Summary")?;
112112
writeln!(summary, "- [Index](./{INDEX_MD_FILE})")?;
113113

114-
for sb in &shelf_config.book {
114+
for sb in &shelf_config.books {
115115
if let Some(url) = &sb.git_url {
116116
println!("{:?}", sb);
117117
let path = sb.path.clone().unwrap_or("root".to_owned());
@@ -206,16 +206,16 @@ path = "../test_book"
206206
let cfg: Shelf = toml::from_str(&toml).unwrap();
207207
assert_eq!(cfg.root_url_prefix.unwrap(), "myprefix");
208208

209-
let book = &cfg.book[0];
209+
let book = &cfg.books[0];
210210
assert_eq!(book.git_url.clone().unwrap(), "firsturl");
211211
assert_eq!(book.git_ref.clone().unwrap(), "shelf");
212212
assert_eq!(book.path.clone().unwrap(), "guide");
213213

214-
let book = &cfg.book[1];
214+
let book = &cfg.books[1];
215215
assert_eq!(book.git_url.clone().unwrap(), "secondurl");
216216
assert!(book.git_ref.is_none());
217217
assert!(book.path.is_none());
218218

219-
let book = &cfg.book[2];
219+
let book = &cfg.books[2];
220220
assert_eq!(book.path.clone().unwrap(), "../test_book");
221221
}

src/config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,8 @@ pub struct ShelfBook {
655655
/// Represents a shelf that contains a lot of books
656656
pub struct Shelf {
657657
/// The books in the shelf
658-
pub book: Vec<ShelfBook>,
658+
#[serde(alias = "book")]
659+
pub books: Vec<ShelfBook>,
659660
/// this will be prepeneded to the backreference url
660661
/// Say you want to publish to www.example.com/mydocs
661662
/// you would set this to "mydocs" and then find your bookshelf at

0 commit comments

Comments
 (0)