forked from reubeno/brush
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprompt.yaml
56 lines (43 loc) · 1.16 KB
/
prompt.yaml
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
name: "Prompt"
cases:
- name: "Simple prompts"
stdin: |
prompt='$ '
echo "Prompt: '${prompt@P}'"
prompt='a\r\n> '
echo "Prompt: '${prompt@P}'"
prompt='\\'
echo "Prompt: '${prompt@P}'"
prompt='\81'
echo "Prompt: '${prompt@P}'"
- name: "Working dir based prompts"
stdin: |
cd /usr
prompt='\w '
echo "Prompt: '${prompt@P}'"
prompt='\W '
echo "Prompt: '${prompt@P}'"
arr=("\w" "\w")
echo "Prompt: '${arr@P}'"
echo "Prompt: '${arr[@]@P}'"
echo "Prompt: '${arr[*]@P}'"
- name: "Non-printing chars"
stdin: |
prompt='\[\]Prompt>\[\]'
echo "Prompt: '${prompt@P}'"
- name: "Hostname in prompts"
stdin: |
prompt='\h '
echo "Prompt: '${prompt@P}'"
prompt='\H '
echo "Prompt: '${prompt@P}'"
- name: "Shell name"
stdin: |
prompt='\s'
[[ "${prompt@P}" == "$(basename $0)" ]]
- name: "Shell version info"
stdin: |
prompt='\v'
[[ "${prompt@P}" =~ ^\d+\.\d+$ ]] && echo "Version is well-formatted"
prompt='\V'
[[ "${prompt@P}" == ^\d+\.\d+\.\d+$ ]] && echo "Release is correct"