Configurable color; better output on first run
This commit is contained in:
parent
a0eb162f93
commit
05fc4549c0
|
@ -1,5 +1,7 @@
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import toml
|
import toml
|
||||||
|
from rich import print
|
||||||
|
|
||||||
if 'XDG_CONFIG_HOME' in os.environ:
|
if 'XDG_CONFIG_HOME' in os.environ:
|
||||||
config_dir = os.environ['XDG_CONFIG_HOME']
|
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:
|
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
|
f.write('''# Disable ascii art if you're using a screen reader or want smaller output
|
||||||
ascii_art = true
|
ascii_art = true
|
||||||
|
# Change the output color
|
||||||
|
# Example: `red`, `#553e78` or `rgb(104,74,112)`
|
||||||
|
color = "#d89961"
|
||||||
|
|
||||||
[repo]
|
[repo]
|
||||||
# Example: `~/backups/backup.borg` or `ssh://agatha@some.place:22/~/backups/backup.borg`
|
# Example: `~/backups/backup.borg` or `ssh://agatha@some.place:22/~/backups/backup.borg`
|
||||||
path = ""
|
path = ""
|
||||||
|
@ -29,5 +35,7 @@ partition = ""
|
||||||
# Otherwise, leave empty.
|
# Otherwise, leave empty.
|
||||||
# Example: `ssh -p 22 agatha@some.place`
|
# Example: `ssh -p 22 agatha@some.place`
|
||||||
ssh = ""''')
|
ssh = ""''')
|
||||||
|
print('No existing configuration found, creating one at: [underline #d89961]' + config_dir + '/config.toml')
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
config = toml.load(config_dir + '/config.toml')
|
config = toml.load(config_dir + '/config.toml')
|
||||||
|
|
2
main.py
2
main.py
|
@ -8,7 +8,7 @@ from rich.progress import Progress, BarColumn
|
||||||
from rich.style import Style
|
from rich.style import Style
|
||||||
from config import config
|
from config import config
|
||||||
|
|
||||||
emphasis = Style(color='#d89961', bold=True)
|
emphasis = Style(color=config['color'] or '#d89961', bold=True)
|
||||||
|
|
||||||
flomp = f'''[{emphasis}]
|
flomp = f'''[{emphasis}]
|
||||||
.=--::
|
.=--::
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from config import config
|
from config import config
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from rich import print
|
||||||
import json
|
import json
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue