Exemplo n.º 1
0
 def printenv(self, argv):
     """printenv [name ...]
 Shows the shell environment that processes will run with.  """
     if len(argv) == 1:
         names = list(self._environ.keys())
         names.sort()
         ms = functools.reduce(max, map(len, names))
         for name in names:
             value = self._environ[name]
             self._print("{:{maxsize}s} = {}".format(name, safe_repr(value), maxsize=ms))
     else:
         s = []
         for name in argv[1:]:
             try:
                 s.append("{} = {}".format(name, safe_repr(self._environ[name])))
             except KeyError:
                 pass
         self._print("\n".join(s))
Exemplo n.º 2
0
 def printenv(self, argv):
     """printenv [name ...]
 Shows the shell environment that processes will run with.  """
     if len(argv) == 1:
         names = list(self._environ.keys())
         names.sort()
         ms = functools.reduce(max, map(len, names))
         for name in names:
             value = self._environ[name]
             self._print("{:{maxsize}s} = {}".format(name,
                                                     safe_repr(value),
                                                     maxsize=ms))
     else:
         s = []
         for name in argv[1:]:
             try:
                 s.append("{} = {}".format(name,
                                           safe_repr(self._environ[name])))
             except KeyError:
                 pass
         self._print("\n".join(s))
Exemplo n.º 3
0
 def show(self, argv):
     """show
 Display list contents."""
     for i, obj in enumerate(self._obj):
         self._print("%5.5s: %s" % (i, safe_repr(obj)))
Exemplo n.º 4
0
 def items(self, argv):
     """items
 Show mapping items."""
     for name, val in self._obj.items():
         self._print("%25.25r: %s" % (name, safe_repr(val)))
Exemplo n.º 5
0
 def show(self, argv):
     """show
 Display list contents."""
     for i, obj in enumerate(self._obj):
         self._print("%5.5s: %s" % (i, safe_repr(obj)))
Exemplo n.º 6
0
 def items(self, argv):
     """items
 Show mapping items."""
     for name, val in self._obj.items():
         self._print("%25.25r: %s" % (name, safe_repr(val)))