Skip to content

Commit

Permalink
added cool prompt :) (hidden behind a setting in config file)
Browse files Browse the repository at this point in the history
  • Loading branch information
Spelis committed Apr 17, 2024
1 parent 00661a2 commit 14c482b
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,15 @@ def help(dictionary, key_to_help_with=None):

aliases = {}


config = configparser.ConfigParser()
config.read(args.config)
conf_nf = config.getboolean("SHELL","NerdFontIcons",fallback=False)
try:
config = configparser.ConfigParser()
config.read(args.config)
conf_nf = config["SHELL"].getboolean("NerdFontIcons")
for k,v in config.items('ALIAS'):
aliases[k] = v
except Exception:
pass # hehe
except:
pass


def getreltime():
Expand Down Expand Up @@ -140,7 +141,7 @@ def listinsert(list, ins_index, obj):
buffer = str(f.read()).split("\n")

filename = args.filename
savestatus = " "
savestatus = " "
debugmode = False
var = {}
lang = ""
Expand Down Expand Up @@ -265,11 +266,21 @@ def run_cmd(line):
# plugins import
import plugins

def color(type,id,text=''):
if conf_nf:
if type == 0:
return '\x1b[0m'
else:
return f'\x1b[{type}8;5;{id}m{text}'
else:
return ''


if not args.script:
while 1:
try:
line = input(
f"{'󰦨' if conf_nf else ''}{getbytes(buffer)}{savestatus}{'' if conf_nf else ''}{filename if filename != '' else 'unnamed'} $ "
f"{color(3,45,'')}{color(3,0)+color(4,45)}{'󰦨 ' if conf_nf else ''}{getbytes(buffer)}{color(3,45)+color(4,36,'')}{color(3,0)+color(4,36)}{savestatus.replace('*','•')}{' ' if conf_nf else ''}{filename if filename != '' else 'unnamed'} {color(0,0)+color(3,36)}{'' if conf_nf else '$'}{color(0,0)} "
)
for k,v in aliases.items():
line = line.replace(k,v)
Expand Down

0 comments on commit 14c482b

Please sign in to comment.