Configurable color; better output on first run

This commit is contained in:
Agatha Lovelace 2021-10-08 03:18:08 +03:00
parent a0eb162f93
commit 05fc4549c0
No known key found for this signature in database
GPG Key ID: 2DB18BA2E0A80BC3
3 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,7 @@
import os
import sys
import toml
from rich import print
if 'XDG_CONFIG_HOME' in os.environ:
config_dir = os.environ['XDG_CONFIG_HOME']
@ -15,6 +17,10 @@ if not os.path.exists(config_dir + '/config.toml'):
with open(config_dir + '/config.toml', 'a+') as f:
f.write('''# Disable ascii art if you're using a screen reader or want smaller output
ascii_art = true
# Change the output color
# Example: `red`, `#553e78` or `rgb(104,74,112)`
color = "#d89961"
[repo]
# Example: `~/backups/backup.borg` or `ssh://agatha@some.place:22/~/backups/backup.borg`
path = ""
@ -29,5 +35,7 @@ partition = ""
# Otherwise, leave empty.
# Example: `ssh -p 22 agatha@some.place`
ssh = ""''')
print('No existing configuration found, creating one at: [underline #d89961]' + config_dir + '/config.toml')
sys.exit()
config = toml.load(config_dir + '/config.toml')

View File

@ -8,7 +8,7 @@ from rich.progress import Progress, BarColumn
from rich.style import Style
from config import config
emphasis = Style(color='#d89961', bold=True)
emphasis = Style(color=config['color'] or '#d89961', bold=True)
flomp = f'''[{emphasis}]
.=--::

View File

@ -1,5 +1,6 @@
from config import config
from datetime import datetime
from rich import print
import json
import subprocess