jpcli 0.4.0__py3-none-any.whl → 0.5.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.
- jpcli/__init__.py +0 -0
- jpcli/main.py +0 -0
- jpcli/parsers/__init__.py +0 -0
- jpcli/parsers/cmdline_parser.py +0 -0
- jpcli/parsers/cpuinfo_parser.py +0 -0
- jpcli/parsers/df_parser.py +0 -0
- jpcli/parsers/dmesg_parser.py +0 -0
- jpcli/parsers/free_parser.py +8 -7
- jpcli/parsers/ifconfig_parser.py +0 -0
- jpcli/parsers/journalctl_parser.py +0 -0
- jpcli/parsers/lscpu_parser.py +0 -0
- jpcli/parsers/lshw_parser.py +0 -0
- jpcli/parsers/lsmem_parser.py +0 -0
- jpcli/parsers/mcelog_parser.py +0 -0
- jpcli/parsers/os_release_parser.py +0 -0
- jpcli/parsers/uname_parser.py +0 -0
- {jpcli-0.4.0.dist-info → jpcli-0.5.0.dist-info}/LICENCE +0 -0
- {jpcli-0.4.0.dist-info → jpcli-0.5.0.dist-info}/METADATA +2 -1
- {jpcli-0.4.0.dist-info → jpcli-0.5.0.dist-info}/RECORD +7 -7
- {jpcli-0.4.0.dist-info → jpcli-0.5.0.dist-info}/WHEEL +1 -1
- {jpcli-0.4.0.dist-info → jpcli-0.5.0.dist-info}/entry_points.txt +0 -0
- {jpcli-0.4.0.dist-info → jpcli-0.5.0.dist-info}/top_level.txt +0 -0
- tests/__init__.py +0 -0
- tests/test_lsmem_parser.py +0 -0
- tests/test_other_command_parser.py +0 -0
jpcli/__init__.py
CHANGED
File without changes
|
jpcli/main.py
CHANGED
File without changes
|
jpcli/parsers/__init__.py
CHANGED
File without changes
|
jpcli/parsers/cmdline_parser.py
CHANGED
File without changes
|
jpcli/parsers/cpuinfo_parser.py
CHANGED
File without changes
|
jpcli/parsers/df_parser.py
CHANGED
File without changes
|
jpcli/parsers/dmesg_parser.py
CHANGED
File without changes
|
jpcli/parsers/free_parser.py
CHANGED
@@ -2,21 +2,22 @@ import json
|
|
2
2
|
|
3
3
|
|
4
4
|
def parse(command_output):
|
5
|
-
lines = command_output.strip().split(
|
5
|
+
lines = command_output.strip().split("\n")
|
6
6
|
headers = lines[0].split()
|
7
7
|
memory_data = []
|
8
8
|
|
9
9
|
for line in lines[1:]:
|
10
10
|
values = line.split()
|
11
|
-
|
11
|
+
category = values[0].strip(":") # Extract "Mem" or "Swap"
|
12
|
+
values = values[1:] # Remove category from values
|
13
|
+
|
14
|
+
# Ensure proper key-value matching
|
12
15
|
if len(values) == len(headers):
|
13
16
|
entry = {headers[i]: values[i] for i in range(len(headers))}
|
14
17
|
else:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
key = headers[i] if i < len(headers) else f'unknown_{i}'
|
19
|
-
entry[key] = values[i]
|
18
|
+
entry = {headers[i]: values[i] if i < len(values) else "N/A" for i in range(len(headers))}
|
19
|
+
|
20
|
+
entry["category"] = category # Add category name separately
|
20
21
|
memory_data.append(entry)
|
21
22
|
|
22
23
|
return json.dumps(memory_data, indent=2)
|
jpcli/parsers/ifconfig_parser.py
CHANGED
File without changes
|
File without changes
|
jpcli/parsers/lscpu_parser.py
CHANGED
File without changes
|
jpcli/parsers/lshw_parser.py
CHANGED
File without changes
|
jpcli/parsers/lsmem_parser.py
CHANGED
File without changes
|
jpcli/parsers/mcelog_parser.py
CHANGED
File without changes
|
File without changes
|
jpcli/parsers/uname_parser.py
CHANGED
File without changes
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: jpcli
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.5.0
|
4
4
|
Summary: A library to convert Linux command output to JSON
|
5
5
|
Home-page: https://github.com/JaimeAdanCuevas/jpcli
|
6
6
|
Author: Jaime Cuevas
|
@@ -12,6 +12,7 @@ Classifier: License :: OSI Approved :: MIT License
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
13
13
|
Requires-Python: >=3.6
|
14
14
|
Description-Content-Type: text/markdown
|
15
|
+
License-File: LICENCE
|
15
16
|
|
16
17
|
# jpcli
|
17
18
|
|
@@ -5,7 +5,7 @@ jpcli/parsers/cmdline_parser.py,sha256=S8PZjDTkxyz2IAY3hBvHDekWRGCkj9MHiLi2haupU
|
|
5
5
|
jpcli/parsers/cpuinfo_parser.py,sha256=aL6NZ-_O_wmGRdZSzm7SttCngWoW7eqWckubxPWFpJk,973
|
6
6
|
jpcli/parsers/df_parser.py,sha256=E2s8c6i60iKrS4IcCv_L_Fu5vDE_xnOTklAk_PFM5T4,549
|
7
7
|
jpcli/parsers/dmesg_parser.py,sha256=v4i7inWGRKycyDIvjTyGaSBIYQZf7tNTJ4lxKKvKSN4,397
|
8
|
-
jpcli/parsers/free_parser.py,sha256=
|
8
|
+
jpcli/parsers/free_parser.py,sha256=fPKU3h_i420vOqefNtNpmBa5so3JCSdiauz6mF4Ra9c,748
|
9
9
|
jpcli/parsers/ifconfig_parser.py,sha256=zEfTi8zdYnpQ4QNgZh1I31Z-mY9F1uAXGV9f6knJeJ0,1353
|
10
10
|
jpcli/parsers/journalctl_parser.py,sha256=z9_6_8Gu798pQekosMCfoieCDGxbNcxOGcbteg4fzQk,949
|
11
11
|
jpcli/parsers/lscpu_parser.py,sha256=b_OzMysCshP2lXY2Vmc-MJlxlYXocNTOvr7DHUeWkvQ,661
|
@@ -17,9 +17,9 @@ jpcli/parsers/uname_parser.py,sha256=Yx59k9JzzfNgKZ9pt3hhfSwk0o9Ow1kqQdQNWUF6asc
|
|
17
17
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
18
|
tests/test_lsmem_parser.py,sha256=mRlHTmU2ZmcxPGgcqAv_LNGs56yrwDBiw2-aHKrpuEo,793
|
19
19
|
tests/test_other_command_parser.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
|
-
jpcli-0.
|
21
|
-
jpcli-0.
|
22
|
-
jpcli-0.
|
23
|
-
jpcli-0.
|
24
|
-
jpcli-0.
|
25
|
-
jpcli-0.
|
20
|
+
jpcli-0.5.0.dist-info/LICENCE,sha256=-unHZSaIlcrVEVD56Ss5dlOvdgK682a2xitz35UlKt4,1069
|
21
|
+
jpcli-0.5.0.dist-info/METADATA,sha256=lX6bauMKqK2faKxNpJ11XDWT0A8HjzveaLtjqJvsRbY,625
|
22
|
+
jpcli-0.5.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
23
|
+
jpcli-0.5.0.dist-info/entry_points.txt,sha256=6wCYs9scOVGFsZE-b2r2geNzy4uST0GgWyHmveiPSxE,43
|
24
|
+
jpcli-0.5.0.dist-info/top_level.txt,sha256=djdbp8mEzCmAEbrMOVEHNW4LIabBwnpLURp2dX_ZQbA,12
|
25
|
+
jpcli-0.5.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
tests/__init__.py
CHANGED
File without changes
|
tests/test_lsmem_parser.py
CHANGED
File without changes
|
File without changes
|