-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathget.py
More file actions
29 lines (23 loc) · 865 Bytes
/
get.py
File metadata and controls
29 lines (23 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import click
import sys
from utils.logger import Logger
from config.config import Settings
from commands.common import common
logger = Logger()
@click.command("get")
@common
def get_command(input_json, scope, exist, updateAutomatically, updateFrequency):
"""Gets the current state of a tstoy configuration file."""
try:
data = Settings.validate(
input_json, scope, exist, updateAutomatically, updateFrequency, 'get', logger
)
settings = Settings.from_dict(data)
result_settings, err = Settings.get_current_state(settings, logger)
if err:
logger.error(f"Failed to get settings: {err}", "get_command")
sys.exit(1)
result_settings.print_config()
except Exception as e:
logger.critical(f"Unexpected error: {str(e)}", "get_command")
sys.exit(1)