summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-08-13 01:52:17 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-08-13 01:52:17 +0000
commit0b5efa2a62623e09c7e8e5e97e0feafbc5e19823 (patch)
tree8c13150c8a0cf0bac69c340ae5358e2cb624330c /ipalib/cli.py
parentc0b5069fa07889496786523c46b5b15181c26fee (diff)
downloadfreeipa-0b5efa2a62623e09c7e8e5e97e0feafbc5e19823.tar.gz
freeipa-0b5efa2a62623e09c7e8e5e97e0feafbc5e19823.tar.xz
freeipa-0b5efa2a62623e09c7e8e5e97e0feafbc5e19823.zip
134: Added CLI.mcl (Max Command Length) property; added corresponding unit tests
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r--ipalib/cli.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index a0b8800f..898f385b 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -50,6 +50,7 @@ def _(arg):
class CLI(object):
__d = None
+ __mcl = None
def __init__(self, api):
self.__api = api
@@ -103,3 +104,14 @@ class CLI(object):
from_cli(m.group(1)),
m.group(2),
)
+
+ def __get_mcl(self):
+ """
+ Returns the Max Command Length.
+ """
+ if self.__mcl is None:
+ if self.__d is None:
+ return None
+ self.__mcl = max(len(k) for k in self.__d)
+ return self.__mcl
+ mcl = property(__get_mcl)