diff options
author | Kevron Rees <kevron.m.rees@intel.com> | 2015-01-14 16:55:30 -0800 |
---|---|---|
committer | Kevron Rees <kevron.m.rees@intel.com> | 2015-01-14 16:55:30 -0800 |
commit | bb2360338fbf4afdf327c6e04a37b0541c767327 (patch) | |
tree | 9bb4faaaecb354134efa04af556ae095ed881d68 | |
parent | 8568f4d93f6c4e196d851b6b17e2957b5d26b64c (diff) | |
download | automotive-message-broker-bb2360338fbf4afdf327c6e04a37b0541c767327.tar.gz |
[ambctl] - fixed tabbing
-rw-r--r-- | tools/ambctl.py | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/tools/ambctl.py b/tools/ambctl.py index fa4260ae..c064a506 100644 --- a/tools/ambctl.py +++ b/tools/ambctl.py @@ -52,7 +52,7 @@ class Autocomplete: except dbus.exceptions.DBusException, error: print error - def complete(self, partialString): + def complete(self, partialString, commandsOnly = False): results = [] sameString = "" @@ -61,9 +61,10 @@ class Autocomplete: if not (len(partialString)) or cmd.name.startswith(partialString): results.append(cmd.name) - for property in self.properties: - if not(len(partialString)) or property.startswith(partialString): - results.append(str(property)) + if not commandsOnly: + for property in self.properties: + if not(len(partialString)) or property.startswith(partialString): + results.append(str(property)) if len(results) > 1 and len(results[0]) > 0: for i in range(len(results[0])): @@ -474,23 +475,27 @@ if args.command == "stdin": cursor_right() elif len(results) and not results[0] == toComplete: - print "" - if len(results) < 3: + print '' + print len(results), "results:" + if len(results) <= 3: print ' '.join(results) else: longestLen = 0 for r in results: if len(r) > longestLen: longestLen = len(r) - for i in range(0, len(results) / 3): + i=0 + while i < len(results) / 3: row = "" - endRow = -1 - if len(results) >= i+3: - endRow = 2 - for col in results[i : endRow]: - row += col - for i in range((longestLen + 5) - len(col)): + numCols = 3 + if len(results) < i+3: + numCols = len(results) - i + for n in xrange(numCols): + row += results[i] + for n in xrange((longestLen + 5) - len(results[i])): row += ' ' + i += 1 + print row redraw(data) |