Updated configs

This commit is contained in:
Dimitris Zlatanidis 2022-06-19 22:18:54 +03:00
parent d86716183c
commit cf0a0f1e5f
2 changed files with 38 additions and 30 deletions

View file

@ -2,7 +2,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os
import json import json
from dataclasses import dataclass from dataclasses import dataclass
@ -47,7 +49,10 @@ class Configs:
wget_options = '-c -N' wget_options = '-c -N'
''' Overwrite with user configuration. ''' ''' Overwrite with user configuration. '''
with open(f'{etc_path}/{prog_name}.json', 'r') as conf: config_file: str = f'{etc_path}/{prog_name}.json'
if os.path.isfile(config_file):
with open(config_file, 'r') as conf:
config = json.load(conf) config = json.load(conf)
# OS architecture by default # OS architecture by default
@ -90,6 +95,7 @@ class Configs:
'GREEN': '', 'GREEN': '',
'YELLOW': '', 'YELLOW': '',
'CYAN': '', 'CYAN': '',
'BLUE': '',
'GREY': '', 'GREY': '',
'ENDC': '' 'ENDC': ''
} }

View file

@ -4,10 +4,12 @@
from dataclasses import dataclass from dataclasses import dataclass
from slpkg.configs import Configs
@dataclass @dataclass
class Version: class Version:
prog_name: str = 'slpkg' prog_name: str = Configs.prog_name
version_info: tuple = (4, 1, 0) version_info: tuple = (4, 1, 0)
version: str = '{0}.{1}.{2}'.format(*version_info) version: str = '{0}.{1}.{2}'.format(*version_info)
license: str = 'MIT License' license: str = 'MIT License'