Skip to content

Commit 5ede72f

Browse files
committed
cli.py: Add docstrings
Signed-off-by: Filip Gołaś <[email protected]>
1 parent 6b38e00 commit 5ede72f

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

osfv_cli/src/osfv/cli/cli.py

+31-3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ def list_used_assets(snipeit_api, args):
6363

6464

6565
def get_my_assets(snipeit_api):
66+
"""
67+
Gets a list of assets assigned to the current user
68+
69+
Args:
70+
snipeit_api: The API client used to interact with the Snipe-IT API.
71+
72+
Returns:
73+
List of assets assigned to the current user
74+
"""
6675
all_assets = snipeit_api.get_all_assets()
6776
used_assets = [asset for asset in all_assets if asset["assigned_to"] is not None]
6877
return [
@@ -72,8 +81,17 @@ def get_my_assets(snipeit_api):
7281
]
7382

7483

75-
# List my assets
7684
def list_my_assets(snipeit_api, args):
85+
"""
86+
Lists all assets assigned to the current user.
87+
88+
Args:
89+
snipeit_api: The API client used to interact with the Snipe-IT API.
90+
args: Command-line arguments object which contains the following attributes:
91+
- json: A boolean indicating to output the list as json.
92+
Returns:
93+
Boolean: False if no assets were assigned to the user, True otherwise
94+
"""
7795
my_assets = get_my_assets(snipeit_api)
7896

7997
if not my_assets:
@@ -88,8 +106,18 @@ def list_my_assets(snipeit_api, args):
88106
return True
89107

90108

91-
# Check in all my assets
92109
def check_in_my(snipeit_api, args):
110+
"""
111+
Lists all assets assigned to the current user, checks in all of them
112+
except those which are in a category listed in `categories_to_ignore`.
113+
114+
Args:
115+
snipeit_api: The API client used to interact with the Snipe-IT API.
116+
args: Command-line arguments object which contains the following attributes:
117+
- yes: A boolean indicating to skip the confirmation prompt.
118+
Returns:
119+
None
120+
"""
93121
categories_to_ignore = ["Employee Laptop"]
94122
my_assets = get_my_assets(snipeit_api)
95123

@@ -604,7 +632,7 @@ def main():
604632
check_in_group.add_argument("--rte_ip", type=str, help="RTE IP address")
605633

606634
check_in_my_parser = snipeit_subparsers.add_parser(
607-
"check_in_my", help="Check in all my used assets"
635+
"check_in_my", help="Check in all my used assets, except work laptops"
608636
)
609637
check_in_my_parser.add_argument(
610638
"-y", "--yes", action="store_true", help="Skips the confirmation"

0 commit comments

Comments
 (0)