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 CHANGED
File without changes
jpcli/main.py CHANGED
File without changes
jpcli/parsers/__init__.py CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -2,21 +2,22 @@ import json
2
2
 
3
3
 
4
4
  def parse(command_output):
5
- lines = command_output.strip().split('\n')
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
- # Ensure that the length of headers and values are the same
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
- # Handle cases where the line might not match header length
16
- entry = {}
17
- for i in range(len(values)):
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)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jpcli
3
- Version: 0.4.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=GJuJKCT4cIN4O5D-rHjalx-6FzDT6-lpUurmh9PnUKE,721
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.4.0.dist-info/LICENCE,sha256=-unHZSaIlcrVEVD56Ss5dlOvdgK682a2xitz35UlKt4,1069
21
- jpcli-0.4.0.dist-info/METADATA,sha256=3KfCVsK1e1wxOccgV0JAOhSVhXQqIL2CirEhh5JyIB0,603
22
- jpcli-0.4.0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
23
- jpcli-0.4.0.dist-info/entry_points.txt,sha256=6wCYs9scOVGFsZE-b2r2geNzy4uST0GgWyHmveiPSxE,43
24
- jpcli-0.4.0.dist-info/top_level.txt,sha256=djdbp8mEzCmAEbrMOVEHNW4LIabBwnpLURp2dX_ZQbA,12
25
- jpcli-0.4.0.dist-info/RECORD,,
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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.44.0)
2
+ Generator: bdist_wheel (0.37.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
tests/__init__.py CHANGED
File without changes
File without changes
File without changes