@@ -63,6 +63,15 @@ def list_used_assets(snipeit_api, args):
63
63
64
64
65
65
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
+ """
66
75
all_assets = snipeit_api .get_all_assets ()
67
76
used_assets = [asset for asset in all_assets if asset ["assigned_to" ] is not None ]
68
77
return [
@@ -72,8 +81,17 @@ def get_my_assets(snipeit_api):
72
81
]
73
82
74
83
75
- # List my assets
76
84
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
+ """
77
95
my_assets = get_my_assets (snipeit_api )
78
96
79
97
if not my_assets :
@@ -88,8 +106,18 @@ def list_my_assets(snipeit_api, args):
88
106
return True
89
107
90
108
91
- # Check in all my assets
92
109
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
+ """
93
121
categories_to_ignore = ["Employee Laptop" ]
94
122
my_assets = get_my_assets (snipeit_api )
95
123
@@ -604,7 +632,7 @@ def main():
604
632
check_in_group .add_argument ("--rte_ip" , type = str , help = "RTE IP address" )
605
633
606
634
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 "
608
636
)
609
637
check_in_my_parser .add_argument (
610
638
"-y" , "--yes" , action = "store_true" , help = "Skips the confirmation"
0 commit comments