forked from DannySantos/cli_framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli_framework.rb
40 lines (35 loc) · 1.15 KB
/
cli_framework.rb
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
def instant_gets
begin
system("stty raw -echo")
str = STDIN.getc
ensure
system("stty -raw echo")
end
end
def indent(content, spaces = "43")
printf "%#{spaces}s %s\n", " ", "#{content}"
end
def blank_indent(spaces = "44")
printf "%#{spaces}s", " "
end
def br(breaks = 1)
breaks.times do
puts ""
end
end
def hr(type = "-")
if type == "="
indent("============================================================================================== ")
else
indent("---------------------------------------------------------------------------------------------- ")
end
end
def invalid_command
br
indent("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
indent("!! !!")
indent("!! INVALID COMMAND! !!")
indent("!! !!")
indent("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
br(2)
end