myLib CLI is a command line interface program that allows you to manage a personal book collection. It allows you to:
- Add and manage books into the system, including some basic information about those books (title, author, published date, edition, description, genre)
- Create and manage collections of books
- List all books, all collections and filter book lists by author, genre or a range of publication dates.
$ myLib command [flags]
author Manage authors
book Manage books
collection Manage collections of books
genre Manage genres
help Help about any command
version Display the version of the program
Use "myLib [command] --help" for more information about a command.
-h, --help Print help
Manage authors
$ myLib author [flags]
$ myLib author [command]
create Create an author
update Update an author
delete Delete an author
-h, --help Print help
Use "myLib book [command] --help" for more information about a command.
$ myLib author create <lastname> [OPTIONS]
-f, --firstname Set the firstname (or initials) of the author
-m, --middlename Set the middlename of the author
-h, --help Print help
Create the author Tolkien with the firstname (or initial) J.R.R.
$ myLib author create Tolkien --firstname=J.R.R.
Author Tolkien created.
- An author is identified by its first name, middle name and last name. Once an author is created, attempting to create another author with the same first name, middle name and last name will display an error message.
$ myLib author update <lastname> [flags]
-l, --lastname Set the last name of the author
-f, --firstname Set the first name of the author
-m, --middlename Set the middle name of the author
-h, --help Print help
Update the author Tolkien and set the first name to "John"
$ myLib author update Tolkien -f John
Author Tolkien updated.
Update the author "sartre" and set the name to "Sartre" and the first name to Jean Paul
$ myLib author update sartre --lastname=Sartre --firstname="Jean Paul"
Author Sartre updated.
If two authors exist with the same last name, the program will prompt you to choose which author to update:
$ myLib author update Tolkien -f J.R.R
Two authors exist with last name Tolkien:
[1] John Tolkien
[2] Christopher Tolkien
Choose which one you want to update or enter c to cancel.
$ myLib author delete <lastname> [flags]
-h, --help Print help
Delete the author Tolkien
$ myLib author delete Tolkien
Author Tolkien deleted.
If two authors exist with the same last name, the program will prompt you to choose which author to delete:
$ myLib author delete Tolkien
Two authors exist with last name Tolkien:
[1] John Tolkien
[2] Christopher Tolkien
Choose which one you want to delete or enter c to cancel.
Manage genres
$ myLib genre [flags]
$ myLib genre [command]
create Create a genre
rename Rename a genre
delete Delete a genre
-h, --help Print help
Use "myLib genre [command] --help" for more information about a command.
$ myLib genre create <name> [flags]
-h, --help Print help
Create the genre Fantasy
$ myLib genre create Fantasy
Genre Fantasy created.
- A genre is identified by its name. Once a genre is created, attempting to create another genre with the same name will display an error message.
$ myLib genre rename <name> <newName> [flags]
-h, --help Print help
Rename the genre "SF" to "Science Fiction"
$ myLib genre rename SF "Science Fiction"
Genre SF renamed as Science Fiction.
$ myLib genre delete <name> [flags]
-h, --help Print help
Delete the genre Fantasy
$ myLib genre delete Fanatsy
Genre Fantasy deleted.
Manage books
$ myLib book [command]
$ myLib book [flags]
create Create a book
update Update a book
delete Delete a book
list List all the books
add Add a book to a collection
remove Remove a book from a collection
assign Assign a genre to a book
unassign Unassign a genre from a book
-h, --help Print help
Use "myLib book [command] --help" for more information about a command.
$ myLib book create <title> [flags]
-a, --authors Set the authors of the book by lastname, separated by commas
-y, --year Set the publication year
-e, --edition Set the edition
-d, --descrition Set a descrition
-g, --genres Set the genres of the book, seperated by commas
-h, --help Print help
Create a book with title The Hobbit
$ myLib book create "The Hobbit"
Book The Hobbit created.
Create a book with title The Hobbit with author Tolkien
$ myLib book create "The Hobbit" -a Tolkien
Book The Hobbit created.
Create a book with all the information possible
$ myLib book create "The Hobbit" \
-a Tolkien -y 1937 \
-d "Also called There and Back Again" \
-g Fantasy, Children \
-e "First edition"
Book The Hobbit created.
A book is identified by its title, authors and edition. If you create a book with the identical title, authors and edition, the program will display an error message.
If you create a book with an author or a genre that does not exist in the database, the program will prompt you with the possibility to create the missing information.
$ myLib create book "Les Hobbit" -a Tolkien
The author Tolkien doesn't exist. Do you want to create it? [y,n]
If you select "no" the book creation will be cancelled. If you select "yes" an author with name Tolkien will be created before the book is created.
If you attempt to create a book with an ambiguous author name, the program will prompt you to choose an author:
$ myLib create book "The Hobbit" -a Tolkien
Two authors exists with last name Tolkien:
[1] J.R.R Tolkien
[2] Christopher Tolkien
Choose which one you want to use or enter c to cancel.
$ myLib book update <title> [flags]
-t, --title Set the title of the book
-a, --authors Set the authors of the book by lastname, separated by commas
-y, --year Set the publication year
-e, --edition Set the edition
-d, --descrition Set a descrition
-g, --genres Set the genres of the book, seperated by commas
-h, --help Print help
Update the book The Hobbit and set the author to Tolkien
$ myLib book update "The Hobbit" -a Tolkien
Book The Hobbit updated.
Update the book "The hobbit" and set the title to "The Hobbit"
$ myLib book update "The hobbit" -t "The Hobbit"
Book The Hobbit updated
If you update a book with an author or a genre that does not exist, the program will prompt you with the possibility to create the missing information.
$ myLib update book "The Hobbit" -g Children
The genre Children doesn't exist. Do you want to create it? [y,n]
If you select "no", the book update will be cancelled. If you select "yes" a genre with the name Children will be created before the book is updated.
If you attempt to create a book with an ambiguous author name, the program will prompt you to choose an author:
$ myLib create book "The Hobbit" -a Tolkien
Two authors exists with last name Tolkien:
[1] J.R.R Tolkien
[2] Christopher Tolkien
Choose which one you want to use or enter c to cancel.
$ myLib book delete <title> [flags]
-h, --help Print help
Delete the book The Hobbit
$ myLib book delete "The Hobbit"
Book The Hobbit deleted.
If two books exist with the same title, the program will prompt you to choose which book to delete:
$ myLib book delete The Hobbit
2 books exist with the title The Hobbit:
[1] The Hobbit by J.R.R Tolkien - 1937 - First Edition
[2] The Hobbit by J.R.R Tolkien - 1937 - Second Edition
Choose which one you want to delete or enter c to cancel.
$ myLib book list [flags]
-a, --author Filter by author
-g, --genre Filter by genre
-f, --from Filter by start of range (year->)
-t, --to Filter by end of range (->year)
-h, --help Print help
List all the books in the library
$ myLib book list
- Oryx and Crake Margaret Atwood 2003 Dystopian fiction
- Ubik Philip K Dick 1969 Science fiction
...
List all the books in the library by the author Tolkien
$ myLib book list -a Tolkien
- The Hobbit J.R.R Tolkien 1937 Fantasy
- The Fellowship of the Ring J.R.R Tolkien 1954 Fantasy
...
List all the books in the library from the year 2000 to the present
$ myLib book list -f 2000
- Book1 Author1 2000 Fantasy
- Book2 Author2 2010 Novel, Science Fiction
...
List all the books in the library from 1990 to 1999
$ myLib book list -f 1990 -t 1999
- Book1 Author1 1992 Fantasy
- Book2 Author2 1998 Novel
...
If you attempt to list books by an ambiguous author name, the program will prompt you to choose the author(s) to list:
$ myLib list book -a Tolkien
Two authors exist with last name Tolkien:
[1] J.R.R Tolkien
[2] Christopher Tolkien
Choose which one you want to use or enter c to cancel.
$ myLib book add <title> <collection> [flags]
-h, --help Print help
Add the book Ubik to the collection "My favorites"
$ myLib book insert Ubik "My favorites"
The book Ubik has been added to the collection My favorites.
If you try to add a book to a non-existent collection, the program will prompt you with the possibility to create the collection.
$ myLib book add Ubik "My favorites"
The collection "My favorites" doesn't exist, do you want to create it? [y/n]
If you select "no" the command will be canceled. If you select "yes" the collection will be created and the book added to the collection.
If you try to add a book with an ambiguous title, the program will prompt you to choose the book to add to the collection:
$ myLib book add Ubik "My favorites"
Two books exist with same title:
[1] Ubik Philip K Dick
[2] Ubik
Choose which one you want to use or enter c to cancel.
$ myLib book remove <title> <collection> [flags]
-h, --help Print help
Remove the book Ubik from the collection My favorites
$ myLib book remove Ubik "My favorites"
The book Ubik has been removed from the collection "My favorites".
$ myLib book assign <title> <genre> [flags]
-h, --help Print help
Assign the genre "Science Fiction" to the book Ubik
$ myLib book assign Ubik "Science Fiction"
The genre Science Fiction been assigned to the book Ubik.
$ myLib book unassign <title> <genre> [flags]
-h, --help Print help
Unassign the genre "Science Fiction" from the book Ubik
$ myLib book unassign Ubik "Science Fiction"
The genre Science Fiction been unassigned from the book Ubik.
Manage collections
$ myLib collection [command]
$ myLib collection [flags]
create Create a collection
rename Rename a collection
delete Delete a collection
list List all collections
add Add book to collection
remove Remove book from collection
-h, --help Print help
Use "myLib collection [command] --help" for more information about a command.
$ myLib collection create <name> [flags]
-h, --help Print help
Create the collection "My favorites"
$ myLib collection create "My favorites"
Collection My favorites created.
$ myLib collection rename <name> <newName> [flags]
-h, --help Print help
Rename the collection "My collection" to "My favorites"
$ myLib collection rename "My collection" "My favorites"
Collection My collection renamed to My favorites
$ myLib collection delete <name> [flags]
-h, --help Print help
Delete the collection My Favorites
$ myLib collection delete "My Favorites"
Collection "My favorites" deleted
If you try to delete a collection that contains books, the program will prompt you to confirm the deletion.
$ myLib collection delete "My favorites"
The collection "My favorites" contains 5 books.
Do you still want to delete the collection? (The books won't be deleted) [y/n]
$ myLib collection list [flags]
-h, --help Print help
List all the collections
$ myLib collection list
- My Favorites
- Study books
- Technical books
...
$ myLib collection add <collection> <title> [flags]
-h, --help Print help
Add the book Ubik to the collection My favorites
$ myLib collection add "My favorites" Ubik
The book Ubik has been added to the collection "My favorites".
If you try to add a book to a non-existent collection, the program will prompt you with the possibility to create the collection.
$ myLib collection add "My favorites" Ubik
The collection "My favorites" doesn't exist, do you want to create it? [y/n]
If you select "no" the command will be canceled. If you select "yes" the collection will be created and the book added to the collection.
If you try to add a book with an ambiguous title, the program will prompt you to choose the book to add to the collection:
$ myLib book add Ubik "My favorites"
2 books exist with same title:
[1] Ubik Philip K Dick
[2] Ubik
Choose which one you want to use or enter c to cancel.
$ myLib collection remove <collection> <title> [flags]
-h, --help Print help
Remove the book Ubik from the collection My favorites
$ myLib collection remove "My favorites" Ubik
The book Ubik has been removed from the collection "My favorites".