A simple command-line interface (CLI) for managing a book collection. This application allows users to add, edit, search, delete books, and clear the console.
- Add books with title, author, and year.
- Edit book details using its ID.
- Display all books or search for specific books using keywords.
- Delete books by ID.
- Clear the console like Unix systems.
- Exit the application.
Add a new book to the collection.
Syntax:
addbook title author year
Example:
addbook "Crime and Punishment" "Fyodor Dostoevsky" 1866
Edit the details of an existing book by its ID.
Syntax:
editbook id kwargs
Example:
editbook 1 title="Crime and Punishment" year=1867
Clear the console screen, similar to Unix systems.
Syntax:
clear
Example:
clear
Exit the CLI program.
Syntax:
exit
Example:
exit
Display all books or search for books based on specific criteria.
Syntax:
books [optional arguments]
Optional Arguments:
keywords=""- Search by keywords in title or author.title=""- Search by title.author=""- Search by author.year=""- Search by year.
Examples:
books
Displays all books.
books title="Crime and Punishment"
Searches for books with the title "Crime and Punishment."
Remove a book from the collection using its ID.
Syntax:
del id
Example:
del 1
- Use double quotes (
"") for strings that contain spaces, such as book titles or author names. - Ensure that all commands are typed correctly; invalid commands will not be executed.
- Python 3.x
- Clone the repository:
git clone https://github.com/yourusername/book-manager-cli.git
- Navigate to the project directory:
cd book-manager-cli - Run the script:
python book_manager.py