-
Notifications
You must be signed in to change notification settings - Fork 0
/
man_pages_cheatsheets.rb
59 lines (53 loc) · 986 Bytes
/
man_pages_cheatsheets.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
brad = true
def main_menu()
puts "--MAIN MENU--"
puts "1. Command line (a few of our favorites!)"
puts "2. Search your own"
puts "3. Exit \n\n"
puts "How would you like to find a manual?"
choice = gets.strip.to_i
if choice > 3
main_menu()
else
choice
end
end
def commands_menu()
puts "--COMMANDS MENU--"
puts "1. cp"
puts "2. mkdir"
puts "3. cat"
puts "4. Back to main menu"
puts "Which man would you like today?"
selection = gets.strip.to_i
command_menu_choices(selection)
end
def search
choice = gets.strip
puts `man #{choice}`
end
def command_menu_choices(param)
case param
when 1
puts `man cp`
when 2
puts `man mkdir`
when 3
puts `man cat`
when 4
main_menu
else
exit
end
end
while brad
case main_menu
when 1
commands_menu
when 2
puts "Enter a man search term:"
search
when 3
brad = false # exit - had exit as command before like line 50, but this is another way
end
end