[
https://issues.apache.org/jira/browse/ARIA-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15983168#comment-15983168
]
ASF GitHub Bot commented on ARIA-146:
-------------------------------------
Github user mxmrlv commented on a diff in the pull request:
https://github.com/apache/incubator-ariatosca/pull/109#discussion_r113235649
--- Diff: aria/cli/color.py ---
@@ -0,0 +1,73 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+from StringIO import StringIO
+
+import colorama
+
+colorama.init()
+
+
+def _get_colors(color_type):
+ for name in dir(color_type):
+ if not name.startswith('_'):
+ yield (name.lower(), getattr(color_type, name))
+
+
+class Color(object):
+ Fore = colorama.Fore
+ Back = colorama.Back
+ Style = colorama.Style
+
+ _colors = {
+ 'fore': dict(_get_colors(Fore)),
+ 'back': dict(_get_colors(Back)),
+ 'style': dict(_get_colors(Style))
+ }
+
+ class Schema(object):
+ def __init__(self, **kwargs):
+ """
+ It is possible to provide fore, back and style arguments. each
could be either
+ the color is lower case letter, or the actual color from
colorama.
+
+ """
+ assert all(arg in Color._colors for arg in kwargs)
--- End diff --
use itertools if necessary
> Support colorful execution logging
> ----------------------------------
>
> Key: ARIA-146
> URL: https://issues.apache.org/jira/browse/ARIA-146
> Project: AriaTosca
> Issue Type: Story
> Reporter: Ran Ziv
> Assignee: Maxim Orlov
> Priority: Minor
>
> Add support for printing execution logs in color
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)