-
Notifications
You must be signed in to change notification settings - Fork 0
/
prompt.py
executable file
·71 lines (62 loc) · 1.49 KB
/
prompt.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
class Color:
Reset = "[00m"
Black = "[30m"
Red = "[31m"
Green = "[32m"
Yellow = "[33m"
Blue = "[34m"
Magenta = "[35m"
Cyan = "[36m"
White1 = "[37m"
Orange = "[91m"
Gray01 = "[92m"
Gray02 = "[93m"
Gray03 = "[94m"
Purple = "[95m"
Gray04 = "[96m"
White2 = "[97m"
width = int(sys.argv[1])
username = sys.argv[2]
hostname = sys.argv[3]
pwd = sys.argv[4]
date = ' '.join(sys.argv[5:])
sep_color = Color.Reset
pwd_color = Color.Blue
uname_color = Color.Green
hname_color = Color.Yellow
date_color = Color.Green
colon_color = Color.Reset
dollar_color = Color.Reset
reset_color = Color.Reset
left = ''.join([
sep_color, "╭", "(",
uname_color, username, "@",
hname_color, hostname,
colon_color, ":",
pwd_color, pwd,
sep_color, ")",
])
right = ''.join([
sep_color, "(",
date_color, date,
sep_color, ")"
])
filler_width = width
filler_width -= len(left.decode("utf-8"))
filler_width -= len(right.decode("utf-8"))
filler_width += 9 * len(Color.Reset)
filler = sep_color + "─" * filler_width
prompt = ''.join([
sep_color, "╰",
dollar_color, "$",
reset_color
])
status_line = left + filler + right
prompt_line = prompt
print(status_line)
print(prompt_line)
# ╭(mgn@tsar:/home/mgn)───────────────────────────────────(Вт 13 дек 2016 18:55)
# ╰$