1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-13 01:20:24 +02:00

Merge pull request #67 from kellyjonbrazil/Dev

Dev v1.11.4
This commit is contained in:
Kelly Brazil
2020-06-10 06:07:42 -07:00
committed by GitHub
5 changed files with 20 additions and 12 deletions

View File

@ -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)

View File

@ -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'

View File

@ -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,8 +226,8 @@ 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)
@ -239,7 +239,6 @@ def parse(data, raw=False, quiet=False):
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:

View File

@ -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.',

View File

@ -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