[modules/time] Add parameter for format string
Format string for strftime is now configurable. Also, changed the separator for module name vs. arguments to "::" to make it possible to have ":" as part of the strftime format string (which is useful in most cases). Eventually, I'll probably have to come up with a better way, i.e. a fully-fledged parser, and move away from "special characters", but right now, the effort seems too much for the gain.
This commit is contained in:
parent
2a35905b89
commit
00c92cb9e3
2 changed files with 4 additions and 3 deletions
|
@ -3,9 +3,10 @@ import bumblebee.module
|
|||
|
||||
class Module(bumblebee.module.Module):
|
||||
def __init__(self, args):
|
||||
self._fmt = args[0] if args else "%x %X"
|
||||
super(Module, self).__init__(args)
|
||||
|
||||
def data(self):
|
||||
return datetime.datetime.now().strftime("%x %X")
|
||||
return datetime.datetime.now().strftime(self._fmt)
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue