bookmanager-cli-amir 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- book/__init__.py +3 -0
- book/book.py +8 -0
- book/manager.py +54 -0
- bookmanager_cli_amir-0.1.0.dist-info/METADATA +34 -0
- bookmanager_cli_amir-0.1.0.dist-info/RECORD +8 -0
- bookmanager_cli_amir-0.1.0.dist-info/WHEEL +5 -0
- bookmanager_cli_amir-0.1.0.dist-info/entry_points.txt +2 -0
- bookmanager_cli_amir-0.1.0.dist-info/top_level.txt +1 -0
book/__init__.py
ADDED
book/book.py
ADDED
book/manager.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from .book import Book
|
|
2
|
+
|
|
3
|
+
class BookManager:
|
|
4
|
+
def __init__(self):
|
|
5
|
+
self.books = []
|
|
6
|
+
|
|
7
|
+
def add_book(self, title: str, author: str, year: int):
|
|
8
|
+
book = Book(title, author, year)
|
|
9
|
+
self.books.append(book)
|
|
10
|
+
print(f"{title} book from {author} in {year} registered.")
|
|
11
|
+
|
|
12
|
+
def remove_book(self, title_name: str, author_name: str):
|
|
13
|
+
found = False
|
|
14
|
+
for rbook in self.books:
|
|
15
|
+
if title_name == rbook.title and author_name == rbook.author:
|
|
16
|
+
self.books.remove(rbook)
|
|
17
|
+
print(f"{title_name} book from {author_name} in {rbook.year} removed.")
|
|
18
|
+
found = True
|
|
19
|
+
break
|
|
20
|
+
if not found:
|
|
21
|
+
print(f"{title_name} does not exist")
|
|
22
|
+
|
|
23
|
+
def search_book(self, title_name):
|
|
24
|
+
found = False
|
|
25
|
+
for book in self.books:
|
|
26
|
+
if title_name == book.title:
|
|
27
|
+
print(book)
|
|
28
|
+
found = True
|
|
29
|
+
|
|
30
|
+
if not found:
|
|
31
|
+
print(f"{title_name} does not exist.")
|
|
32
|
+
|
|
33
|
+
def search_by_author(self, author_name):
|
|
34
|
+
found = False
|
|
35
|
+
for book in self.books:
|
|
36
|
+
if author_name == book.author:
|
|
37
|
+
print(f"{book.title} | {book.author} | {book.year}")
|
|
38
|
+
found = True
|
|
39
|
+
|
|
40
|
+
if not found:
|
|
41
|
+
print(f"{author_name} does not exist.")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def show_all(self):
|
|
45
|
+
if not self.books:
|
|
46
|
+
print("no books exist")
|
|
47
|
+
else:
|
|
48
|
+
for book in self.books:
|
|
49
|
+
print(f"{book.title} | {book.author} | {book.year}")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bookmanager-cli-amir
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A simple book management CLI tool
|
|
5
|
+
Home-page: https://github.com/AmirK8585/bookmanager-cli.git
|
|
6
|
+
Author: Amir
|
|
7
|
+
Author-email: amirhossein070305@email.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: author-email
|
|
15
|
+
Dynamic: classifier
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: description-content-type
|
|
18
|
+
Dynamic: home-page
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
# Book Manager CLI
|
|
23
|
+
|
|
24
|
+
A simple command-line tool to manage your books.
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
- Add books
|
|
28
|
+
- Remove books
|
|
29
|
+
- Search by title or author
|
|
30
|
+
- Show all books
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
```bash
|
|
34
|
+
pip install -e .
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
book/__init__.py,sha256=Hh42IUiT589BX7DzDZiN_u1qr8vjcxqMkeEYzLs8azE,57
|
|
2
|
+
book/book.py,sha256=NH2vy17XI4bMvx8A3VKhGQo42_2ljxObiUCoUczR3Ac,238
|
|
3
|
+
book/manager.py,sha256=g9bMaJDz5tlKHO1eRk2axebvMgc6M_CT2Hw0V1tDyhQ,1554
|
|
4
|
+
bookmanager_cli_amir-0.1.0.dist-info/METADATA,sha256=QRBWzhjCDH_bErrfs-lsu0fb4EOKp5Nodsybf5fH-5Q,802
|
|
5
|
+
bookmanager_cli_amir-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
6
|
+
bookmanager_cli_amir-0.1.0.dist-info/entry_points.txt,sha256=vrHRKxhoIN7S4_SHFECE0J21OVZA1OhvO6XdzCSiBns,46
|
|
7
|
+
bookmanager_cli_amir-0.1.0.dist-info/top_level.txt,sha256=PE2_-e7alBCguetCNHKYHbiZfWZjiLTNJCRwDDl01ks,5
|
|
8
|
+
bookmanager_cli_amir-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
book
|