1
0
mirror of https://github.com/gryf/mc_adbfs.git synced 2025-12-18 20:10:21 +01:00

Added option for suppressing colors for ls command from busybox

This commit is contained in:
2016-10-06 14:14:28 +02:00
parent 210d7f2962
commit 57509eaac0
2 changed files with 12 additions and 4 deletions

12
adbfs
View File

@@ -48,17 +48,17 @@ class Conf(object):
r'(?P<size>\d+)?\s'
r'(?P<date>\d{4}-\d{2}-\d{2}\s'
r'\d{2}:\d{2})\s'
r'(?P<name>.*)'}
}
r'(?P<name>.*)'}}
def __init__(self):
self.box = None
self.debug = False
self.dirs_to_skip = ["acct", "charger", "d", "dev", "proc", "sys"]
self.root = None
self.suppress_colors = False
self.get_the_box()
self.read()
self.get_the_box()
def get_the_box(self):
"""Detect if we dealing with busybox or toolbox"""
@@ -67,9 +67,12 @@ class Conf(object):
result = subprocess.check_output('adb shell which '
'busybox'.split(),
stderr=fnull)
if 'busybox' in result:
self.box = Conf.boxes['busybox']
if self.suppress_colors:
self.box.update({'ls': 'busybox ls --color=none -anel',
'rls': 'busybox ls --color=none '
'-Ranel {}'})
Adb.file_re = re.compile(self.box['file_re'])
return
except subprocess.CalledProcessError:
@@ -106,6 +109,7 @@ class Conf(object):
cfg = ConfigParser.SafeConfigParser()
cfg_map = {'debug': (cfg.getboolean, 'debug'),
'dirs_to_skip': (cfg.get, 'dirs_to_skip'),
'suppress_colors': (cfg.get, 'suppress_colors'),
'root': (cfg.get, 'root')}
cfg.read(conf_fname)