Pārlūkot izejas kodu

Update output style

theenglishway (time) 6 gadi atpakaļ
vecāks
revīzija
c01870699e

+ 2 - 1
planner/cli.py

@@ -13,6 +13,7 @@ from planner.utils import Term
 def main(ctx, db):
     """Basic CLI project-handling"""
     ctx.ensure_object(dict)
+    ctx.obj['model'] = Milestone
 
 
 @main.group()
@@ -132,7 +133,7 @@ def new_comment(ctx, item_id, text):
     }
     save_or_display_errors(model, data)
 
-@click.command()
+@main.command()
 @click.pass_context
 def list(ctx):
     """List"""

+ 7 - 7
planner/models/items.py

@@ -13,9 +13,9 @@ from planner.utils import Term
 @dataclass(repr=False)
 class Item(TemplateMixin, SchemaMixin, DbMixin):
     cache_keys = ('name', 'milestone_id', 'sprint_id')
-    template_term = """{{ obj.name }} {{ Term.uuid(obj.short_uuid) }} ({{ obj.term_priority }}, {{ obj.term_length }})
-    {% for comment in obj.comments %}
-        {{- comment.as_term }}
+    template_term = """{{ obj.type_term }} {{ Term.uuid(obj.short_uuid) }} # {{ obj.name }} ({{ obj.term_priority }}, {{ obj.term_length }})
+    {%- for comment in obj.comments %}
+      {{ comment.as_term }}
     {%- endfor %}"""
 
     document: dict
@@ -144,16 +144,16 @@ class Item(TemplateMixin, SchemaMixin, DbMixin):
 
 
 class Limitation(Item):
-    ...
+    type_term = Term.important('Lim. ')
 
 
 class Feature(Item):
-    ...
+    type_term = Term.not_important('Feat.')
 
 
 class Constraint(Item):
-    ...
+    type_term = Term.not_important('Cons.')
 
 
 class Unknown(Item):
-    ...
+    type_term = Term.mildly_important('Unkn.')

+ 3 - 3
planner/models/milestones.py

@@ -12,9 +12,9 @@ from .mixins import TemplateMixin, SchemaMixin, DbMixin
 @dataclass(repr=False)
 class Milestone(TemplateMixin, SchemaMixin, DbMixin):
     cache_keys = ('name',)
-    template_term = """Milestone '{{- obj.name }}' {{ Term.uuid(obj.short_uuid) }}
-    {% for item in obj.items %}
-        {{- item.as_term }}
+    template_term = """{{ Term.bold('Milestone') }} {{ Term.uuid(obj.short_uuid) }} # {{ obj.name }} 
+    {% for item in obj.sprints %}
+      {{- item.as_term }}
     {% endfor %}"""
 
     document: dict

+ 4 - 4
planner/models/sprints.py

@@ -11,10 +11,10 @@ from planner import db
 @dataclass(repr=False)
 class Sprint(TemplateMixin, SchemaMixin, DbMixin):
     cache_keys = ('name',)
-    template_term = """Sprint '{{- obj.name }}' {{ Term.uuid(obj.short_uuid) }}
-    {% for item in obj.items %}
-        {{- item.as_term }}
-    {% endfor %}"""
+    template_term = """{{ Term.bold('Sprint') }} {{ Term.uuid(obj.short_uuid) }} # {{ obj.name }} 
+    {%- for item in obj.items %}
+      {{ item.as_term }}
+    {%- endfor %}"""
 
     document: dict
     name: str

+ 3 - 0
planner/utils.py

@@ -17,5 +17,8 @@ class Term:
     def mildly_important(text):
         return colored(text, 'yellow')
 
+    def bold(text):
+        return colored(text, attrs=['bold'])
+
     def uuid(text):
         return colored(text, 'magenta')