mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-13 01:20:24 +02:00
@ -1,5 +1,8 @@
|
|||||||
jc changelog
|
jc changelog
|
||||||
|
|
||||||
|
20200610 v1.11.4
|
||||||
|
- Update ls parser to fix error on parsing an empty directory
|
||||||
|
|
||||||
20200609 v1.11.3
|
20200609 v1.11.3
|
||||||
- Add local parser plugin feature (contributed by Dean Serenevy)
|
- Add local parser plugin feature (contributed by Dean Serenevy)
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import jc.appdirs as appdirs
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.11.3'
|
version = '1.11.4'
|
||||||
description = 'jc cli output JSON conversion tool'
|
description = 'jc cli output JSON conversion tool'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
|
@ -149,7 +149,7 @@ import jc.utils
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.4'
|
version = '1.5'
|
||||||
description = 'ls command parser'
|
description = 'ls command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -226,20 +226,19 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
linedata = data.splitlines()
|
linedata = data.splitlines()
|
||||||
|
|
||||||
# Delete first line if it starts with 'total 1234'
|
|
||||||
if linedata:
|
if linedata:
|
||||||
|
# Delete first line if it starts with 'total 1234'
|
||||||
if re.match(r'total [0-9]+', linedata[0]):
|
if re.match(r'total [0-9]+', linedata[0]):
|
||||||
linedata.pop(0)
|
linedata.pop(0)
|
||||||
|
|
||||||
# Look for parent line if glob or -R is used
|
# Look for parent line if glob or -R is used
|
||||||
if not re.match(r'[-dclpsbDCMnP?]([-r][-w][-xsS]){2}([-r][-w][-xtT])[+]?', linedata[0]) \
|
if not re.match(r'[-dclpsbDCMnP?]([-r][-w][-xsS]){2}([-r][-w][-xtT])[+]?', linedata[0]) \
|
||||||
and linedata[0].endswith(':'):
|
and linedata[0].endswith(':'):
|
||||||
parent = linedata.pop(0)[:-1]
|
parent = linedata.pop(0)[:-1]
|
||||||
# Pop following total line if it exists
|
# Pop following total line if it exists
|
||||||
if re.match(r'total [0-9]+', linedata[0]):
|
if re.match(r'total [0-9]+', linedata[0]):
|
||||||
linedata.pop(0)
|
linedata.pop(0)
|
||||||
|
|
||||||
if linedata:
|
|
||||||
# Check if -l was used to parse extra data
|
# Check if -l was used to parse extra data
|
||||||
if re.match(r'[-dclpsbDCMnP?]([-r][-w][-xsS]){2}([-r][-w][-xtT])[+]?', linedata[0]):
|
if re.match(r'[-dclpsbDCMnP?]([-r][-w][-xsS]){2}([-r][-w][-xtT])[+]?', linedata[0]):
|
||||||
for entry in linedata:
|
for entry in linedata:
|
||||||
|
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ with open('README.md', 'r') as f:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name='jc',
|
name='jc',
|
||||||
version='1.11.3',
|
version='1.11.4',
|
||||||
author='Kelly Brazil',
|
author='Kelly Brazil',
|
||||||
author_email='kellyjonbrazil@gmail.com',
|
author_email='kellyjonbrazil@gmail.com',
|
||||||
description='Converts the output of popular command-line tools and file-types to JSON.',
|
description='Converts the output of popular command-line tools and file-types to JSON.',
|
||||||
|
@ -215,6 +215,12 @@ class MyTests(unittest.TestCase):
|
|||||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/ls-lR-empty-folder.json'), 'r', encoding='utf-8') as f:
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/ls-lR-empty-folder.json'), 'r', encoding='utf-8') as f:
|
||||||
self.osx_10_14_6_ls_lR_empty_folder_json = json.loads(f.read())
|
self.osx_10_14_6_ls_lR_empty_folder_json = json.loads(f.read())
|
||||||
|
|
||||||
|
def test_ls_empty_dir(self):
|
||||||
|
"""
|
||||||
|
Test plain 'ls' on an empty directory
|
||||||
|
"""
|
||||||
|
self.assertEqual(jc.parsers.ls.parse('', quiet=True), [])
|
||||||
|
|
||||||
def test_ls_centos_7_7(self):
|
def test_ls_centos_7_7(self):
|
||||||
"""
|
"""
|
||||||
Test plain 'ls /' on Centos 7.7
|
Test plain 'ls /' on Centos 7.7
|
||||||
|
Reference in New Issue
Block a user