comparison libervia/cli/constants.py @ 4075:47401850dec6

refactoring: rename `libervia.frontends.jp` to `libervia.cli`
author Goffi <goffi@goffi.org>
date Fri, 02 Jun 2023 14:54:26 +0200
parents libervia/frontends/jp/constants.py@26b7ed2817da
children 51744ad00a42
comparison
equal deleted inserted replaced
4074:26b7ed2817da 4075:47401850dec6
1 #!/usr/bin/env python3
2
3
4 # Primitivus: a SAT frontend
5 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org)
6
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
16
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20 from libervia.frontends.quick_frontend import constants
21 from libervia.backend.tools.common.ansi import ANSI as A
22
23
24 class Const(constants.Const):
25
26 APP_NAME = "Libervia CLI"
27 APP_COMPONENT = "CLI"
28 APP_NAME_ALT = "jp"
29 APP_NAME_FILE = "libervia_cli"
30 CONFIG_SECTION = APP_COMPONENT.lower()
31 PLUGIN_CMD = "commands"
32 PLUGIN_OUTPUT = "outputs"
33 OUTPUT_TEXT = "text" # blob of unicode text
34 OUTPUT_DICT = "dict" # simple key/value dictionary
35 OUTPUT_LIST = "list"
36 OUTPUT_LIST_DICT = "list_dict" # list of dictionaries
37 OUTPUT_DICT_DICT = "dict_dict" # dict of nested dictionaries
38 OUTPUT_MESS = "mess" # messages (chat)
39 OUTPUT_COMPLEX = "complex" # complex data (e.g. multi-level dictionary)
40 OUTPUT_XML = "xml" # XML node (as unicode string)
41 OUTPUT_LIST_XML = "list_xml" # list of XML nodes (as unicode strings)
42 OUTPUT_XMLUI = "xmlui" # XMLUI as unicode string
43 OUTPUT_LIST_XMLUI = "list_xmlui" # list of XMLUI (as unicode strings)
44 OUTPUT_TYPES = (
45 OUTPUT_TEXT,
46 OUTPUT_DICT,
47 OUTPUT_LIST,
48 OUTPUT_LIST_DICT,
49 OUTPUT_DICT_DICT,
50 OUTPUT_MESS,
51 OUTPUT_COMPLEX,
52 OUTPUT_XML,
53 OUTPUT_LIST_XML,
54 OUTPUT_XMLUI,
55 OUTPUT_LIST_XMLUI,
56 )
57 OUTPUT_NAME_SIMPLE = "simple"
58 OUTPUT_NAME_XML = "xml"
59 OUTPUT_NAME_XML_RAW = "xml-raw"
60 OUTPUT_NAME_JSON = "json"
61 OUTPUT_NAME_JSON_RAW = "json-raw"
62
63 # Pubsub options flags
64 SERVICE = "service" # service required
65 NODE = "node" # node required
66 ITEM = "item" # item required
67 SINGLE_ITEM = "single_item" # only one item is allowed
68 MULTI_ITEMS = "multi_items" # multiple items are allowed
69 NO_MAX = "no_max" # don't add --max option for multi items
70 CACHE = "cache" # add cache control flag
71
72 # ANSI
73 A_HEADER = A.BOLD + A.FG_YELLOW
74 A_SUBHEADER = A.BOLD + A.FG_RED
75 # A_LEVEL_COLORS may be used to cycle on colors according to depth of data
76 A_LEVEL_COLORS = (A_HEADER, A.BOLD + A.FG_BLUE, A.FG_MAGENTA, A.FG_CYAN)
77 A_SUCCESS = A.BOLD + A.FG_GREEN
78 A_FAILURE = A.BOLD + A.FG_RED
79 A_WARNING = A.BOLD + A.FG_RED
80 #  A_PROMPT_* is for shell
81 A_PROMPT_PATH = A.BOLD + A.FG_CYAN
82 A_PROMPT_SUF = A.BOLD
83 # Files
84 A_DIRECTORY = A.BOLD + A.FG_CYAN
85 A_FILE = A.FG_WHITE