mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 19:15:22 +00:00
style fix list_tables.py
This commit is contained in:
parent
986a7d36d3
commit
c60b987388
@ -34,17 +34,18 @@ import os
|
||||
import sys
|
||||
import ujson
|
||||
|
||||
result = []
|
||||
with tempfile.NamedTemporaryFile() as output_stream:
|
||||
subprocess.call(['/sbin/pfctl','-sT'], stdout=output_stream, stderr=open(os.devnull, 'wb'))
|
||||
output_stream.seek(0)
|
||||
for line in output_stream.read().strip().split('\n'):
|
||||
result.append(line.strip())
|
||||
if __name__ == '__main__':
|
||||
result = []
|
||||
with tempfile.NamedTemporaryFile() as output_stream:
|
||||
subprocess.call(['/sbin/pfctl', '-sT'], stdout=output_stream, stderr=open(os.devnull, 'wb'))
|
||||
output_stream.seek(0)
|
||||
for line in output_stream.read().strip().split('\n'):
|
||||
result.append(line.strip())
|
||||
|
||||
# handle command line argument (type selection)
|
||||
if len(sys.argv) > 1 and sys.argv[1] == 'json':
|
||||
print(ujson.dumps(result))
|
||||
else:
|
||||
# output plain
|
||||
for table in result:
|
||||
print (table)
|
||||
# handle command line argument (type selection)
|
||||
if len(sys.argv) > 1 and sys.argv[1] == 'json':
|
||||
print(ujson.dumps(result))
|
||||
else:
|
||||
# output plain
|
||||
for table in result:
|
||||
print (table)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user