mirror of
https://github.com/b-ryan/powerline-shell.git
synced 2026-09-10 07:26:28 -04:00
define custom segments
This commit is contained in:
parent
73b01d6597
commit
bc9aea89c5
|
|
@ -8,6 +8,7 @@ import importlib
|
|||
import json
|
||||
from .utils import warn, py3, import_file
|
||||
import re
|
||||
import imp
|
||||
|
||||
|
||||
def _current_dir():
|
||||
|
|
@ -216,7 +217,10 @@ def main():
|
|||
powerline = Powerline(args, config, theme)
|
||||
segments = []
|
||||
for seg_name in config["segments"]:
|
||||
mod = importlib.import_module("powerline_shell.segments." + seg_name)
|
||||
if seg_name.endswith(".py") and os.path.exists(seg_name):
|
||||
mod = imp.load_source("powerline_shell.segments." + os.path.splitext(os.path.basename(seg_name))[0], seg_name)
|
||||
else:
|
||||
mod = importlib.import_module("powerline_shell.segments." + seg_name)
|
||||
segment = getattr(mod, "Segment")(powerline)
|
||||
segment.start()
|
||||
segments.append(segment)
|
||||
|
|
|
|||
Loading…
Reference in a new issue