ezbash 1.0.0 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/ezbash +79 -97
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bfd9afcacdec744c35523ada7f90e819d2909df
|
4
|
+
data.tar.gz: 9160f7431c931c15860a6baafe7b2262c30fad8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ef090f8dfdc5b1422675d4e1affaee378e68afe4e2bc0c6f52b4153e44db99a2f2e06d7d2dcc3fc7272e352b922dbb910c30067602e691043ebd11c3ee848cc
|
7
|
+
data.tar.gz: a9cd6a50932040f7681e77d9c486255afa91fa5783f3641f721fe72870ccf282a700d26fec651dee0a12f28fb70257f17dd8f28878f73c08751dd32fa71ad370
|
data/bin/ezbash
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require
|
2
|
+
require 'pretty_table'
|
3
3
|
|
4
4
|
#Define methods
|
5
|
-
def
|
5
|
+
def addBrew()
|
6
6
|
if `which brew` == ''
|
7
7
|
puts 'You appear to be running MacOS without Homebrew installed.'
|
8
8
|
puts "If you don\'t know what Homebrew is, visit 'brew.sh', if you do and would like to install it, type 'yes'. >> "
|
9
|
-
|
10
|
-
|
11
|
-
until
|
12
|
-
if
|
9
|
+
userReply = gets.chomp
|
10
|
+
userReply.downcase!
|
11
|
+
until userSelect == true
|
12
|
+
if userReply == 'yes'
|
13
13
|
Kernel.system "ruby -e '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'"
|
14
|
-
|
15
|
-
elsif
|
14
|
+
userSelect = true
|
15
|
+
elsif userReply == 'no'
|
16
16
|
puts "That\'s fine! Just keep in mind, the install, uninstall, and search commands won\'t work for you."
|
17
|
-
|
17
|
+
userSelect = true
|
18
18
|
else
|
19
19
|
puts 'Please say yes or no.'
|
20
20
|
end
|
@@ -22,82 +22,82 @@ def addbrew()
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
25
|
+
def installDeb(package)
|
26
26
|
Kernel.system "sudo apt-get install #{package}"
|
27
27
|
puts "\r"
|
28
28
|
puts "I ran: 'sudo apt-get install #{package}'"
|
29
29
|
end
|
30
|
-
def
|
30
|
+
def installRpm(package)
|
31
31
|
Kernel.system "sudo yum install #{package}"
|
32
32
|
puts "\r"
|
33
33
|
puts "I ran: 'sudo yum install #{package}'"
|
34
34
|
end
|
35
|
-
def
|
35
|
+
def installPac(package)
|
36
36
|
Kernel.system "sudo pacman -S #{package}"
|
37
37
|
puts "\r"
|
38
38
|
puts "I ran: 'sudo pacman -S #{package}'"
|
39
39
|
puts 'Shouldn\'t you know how to use pacman if you\'re using Arch? Just kidding.'
|
40
40
|
end
|
41
|
-
def
|
41
|
+
def installHb(package)
|
42
42
|
Kernel.system "brew install #{package}"
|
43
43
|
puts "\r"
|
44
44
|
puts "I ran: 'brew install #{package}'"
|
45
45
|
end
|
46
|
-
def
|
46
|
+
def uninstallDeb(package)
|
47
47
|
Kernel.system "sudo apt-get remove #{package}"
|
48
48
|
puts "\r"
|
49
49
|
puts "I ran: 'sudo apt-get remove #{package}'"
|
50
50
|
end
|
51
|
-
def
|
51
|
+
def uninstallRpm(package)
|
52
52
|
Kernel.system "sudo yum uninstall #{package}"
|
53
53
|
puts "\r"
|
54
54
|
puts "I ran: 'sudo yum uninstall #{package}'"
|
55
55
|
end
|
56
|
-
def
|
56
|
+
def uninstallPac(package)
|
57
57
|
Kernel.system "sudo pacman -R #{package}"
|
58
58
|
puts "\r"
|
59
59
|
puts "I ran: 'sudo pacman -R #{package}'"
|
60
60
|
puts 'Shouldn\'t you know how to use pacman if you\'re using Arch? Just kidding.'
|
61
61
|
end
|
62
|
-
def
|
62
|
+
def uninstallHb(package)
|
63
63
|
Kernel.system "brew uninstall #{package}"
|
64
64
|
puts "\r"
|
65
65
|
puts "I ran: 'brew uninstall #{package}'"
|
66
66
|
end
|
67
|
-
def
|
67
|
+
def searchDeb(package)
|
68
68
|
Kernel.system "apt-cache search #{package}"
|
69
69
|
puts "\r"
|
70
70
|
puts "I ran: 'apt-cache search #{package}'"
|
71
71
|
end
|
72
|
-
def
|
72
|
+
def searchRpm(package)
|
73
73
|
Kernel.system "yum search #{package}"
|
74
74
|
puts "\r"
|
75
75
|
puts "I ran: 'yum search #{package}'"
|
76
76
|
end
|
77
|
-
def
|
77
|
+
def searchPac(package)
|
78
78
|
Kernel.system "pacman -Ss #{package}"
|
79
79
|
puts "\r"
|
80
80
|
puts "I ran: 'pacman -Ss #{package}'"
|
81
81
|
puts 'Shouldn\'t you know how to use pacman if you\'re using Arch? Just kidding.'
|
82
82
|
end
|
83
|
-
def
|
83
|
+
def searchHb(package)
|
84
84
|
Kernel.system "brew search #{package}"
|
85
85
|
puts "\r"
|
86
86
|
puts "I ran: 'brew search #{package}'"
|
87
87
|
end
|
88
88
|
|
89
89
|
#Detect OS
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
if
|
90
|
+
osRaw = `uname -a`
|
91
|
+
osRaw.downcase!
|
92
|
+
osLin = osRaw.split(' ')[5]
|
93
|
+
osDar = osRaw.split(' ')[3]
|
94
|
+
if osDar == 'darwin' then addBrew() end
|
95
95
|
|
96
96
|
#Start Program
|
97
97
|
puts ' '
|
98
98
|
runOnce = false
|
99
|
-
|
100
|
-
while
|
99
|
+
exitIs = 0
|
100
|
+
while exitIs == 0 do
|
101
101
|
if runOnce == true then puts "\r" end
|
102
102
|
print "Type 'help' to list possible commands. >> "
|
103
103
|
userCommand = gets.chomp
|
@@ -109,24 +109,24 @@ while exitis == 0 do
|
|
109
109
|
print 'Please enter the name of the program you\'d like to install. >> '
|
110
110
|
package = gets.chomp
|
111
111
|
package.downcase!
|
112
|
-
case
|
112
|
+
case osLin
|
113
113
|
when 'ubuntu'
|
114
|
-
|
114
|
+
installDeb(package)
|
115
115
|
when 'debian'
|
116
|
-
|
116
|
+
installDeb(package)
|
117
117
|
when 'linux mint'
|
118
|
-
|
118
|
+
installDeb(package)
|
119
119
|
when 'redhat'
|
120
|
-
|
120
|
+
installRpm(package)
|
121
121
|
when 'fedora'
|
122
|
-
|
122
|
+
installRpm(package)
|
123
123
|
when 'open suse'
|
124
|
-
|
124
|
+
installRpm(package)
|
125
125
|
when 'arch'
|
126
|
-
|
126
|
+
installPac(package)
|
127
127
|
else
|
128
|
-
if
|
129
|
-
|
128
|
+
if osDar == 'darwin'
|
129
|
+
installHb(package)
|
130
130
|
else
|
131
131
|
print "\r"
|
132
132
|
puts 'Sorry, I didn\'t recognize you\'re operating system.'
|
@@ -137,24 +137,24 @@ while exitis == 0 do
|
|
137
137
|
print 'Please enter the name of the program you\'d like to remove. >> '
|
138
138
|
package = gets.chomp
|
139
139
|
package.downcase
|
140
|
-
|
141
|
-
|
142
|
-
|
140
|
+
case osLin
|
141
|
+
when 'ubuntu'
|
142
|
+
uninstallDeb(package)
|
143
143
|
when 'debian'
|
144
|
-
|
144
|
+
uninstallDeb(package)
|
145
145
|
when 'linux mint'
|
146
|
-
|
146
|
+
uninstallDeb(package)
|
147
147
|
when 'redhat'
|
148
|
-
|
148
|
+
uninstallRpm(package)
|
149
149
|
when 'fedora'
|
150
|
-
|
150
|
+
uninstallRpm(package)
|
151
151
|
when 'open suse'
|
152
|
-
|
152
|
+
uninstallRpm(package)
|
153
153
|
when 'arch'
|
154
|
-
|
154
|
+
uninstallPac(package)
|
155
155
|
else
|
156
|
-
if
|
157
|
-
|
156
|
+
if osDar == 'darwin'
|
157
|
+
uninstallHb(package)
|
158
158
|
else
|
159
159
|
print "\r"
|
160
160
|
puts 'Sorry, I didn\'t recognize you\'re operating system.'
|
@@ -165,24 +165,24 @@ while exitis == 0 do
|
|
165
165
|
print 'Please enter the name of the program you\'d like to search for. >> '
|
166
166
|
package = gets.chomp
|
167
167
|
package.downcase!
|
168
|
-
case
|
168
|
+
case osLin
|
169
169
|
when 'ubuntu'
|
170
|
-
|
170
|
+
searchDeb(package)
|
171
171
|
when 'debian'
|
172
|
-
|
172
|
+
searchDeb(package)
|
173
173
|
when 'linux mint'
|
174
|
-
|
174
|
+
searchDeb(package)
|
175
175
|
when 'redhat'
|
176
|
-
|
176
|
+
searchRpm(package)
|
177
177
|
when 'fedora'
|
178
|
-
|
178
|
+
searchRpm(package)
|
179
179
|
when 'open suse'
|
180
|
-
|
180
|
+
searchRpm(package)
|
181
181
|
when 'arch'
|
182
|
-
|
182
|
+
searchPac(package)
|
183
183
|
else
|
184
|
-
if
|
185
|
-
|
184
|
+
if osDar == 'darwin'
|
185
|
+
searchHb(package)
|
186
186
|
else
|
187
187
|
print "\r"
|
188
188
|
puts 'Sorry, I didn\'t recognize you\'re operating system.'
|
@@ -192,23 +192,23 @@ while exitis == 0 do
|
|
192
192
|
#File/folder manipulation
|
193
193
|
when 'copy'
|
194
194
|
print 'Please enter the path to the file (e.g. Downloads/report.doc) >> '
|
195
|
-
|
195
|
+
cpFile = gets.chomp
|
196
196
|
puts ' '
|
197
197
|
print 'Please enter the destination inclduding the name of the file (e.g. Documents/report.doc) >> '
|
198
|
-
|
199
|
-
Kernel.system "cp -avr #{
|
198
|
+
cpDest = gets.chomp
|
199
|
+
Kernel.system "cp -avr #{cpFile} #{cpDest}"
|
200
200
|
puts "\r"
|
201
|
-
puts "I ran: 'cp #{
|
201
|
+
puts "I ran: 'cp #{cpFile} #{cpDest}'"
|
202
202
|
runOnce = true
|
203
203
|
when 'rename'
|
204
204
|
print 'Please enter the path to the file (e.g. Documents/report.doc). >> '
|
205
|
-
|
205
|
+
cpFile = gets.chomp
|
206
206
|
puts ' '
|
207
207
|
print 'Please enter the new name inclduding the destination you used earlier (e.g. Documents/Essay.doc). >> '
|
208
|
-
|
209
|
-
Kernel.system "cp #{
|
208
|
+
cpDest = gets.chomp
|
209
|
+
Kernel.system "cp #{cpFile} #{cpDest}"
|
210
210
|
puts "\r"
|
211
|
-
puts "I ran: 'cp #{
|
211
|
+
puts "I ran: 'cp #{cpFile} #{cpDest}'"
|
212
212
|
runOnce = true
|
213
213
|
when 'delete file'
|
214
214
|
print 'Please enter the name of the file you\'d like to remove along with its directory (e.g. Documents/sensitive.doc). >> '
|
@@ -224,6 +224,13 @@ while exitis == 0 do
|
|
224
224
|
puts "\r"
|
225
225
|
puts "I ran: 'rm -R -i #{folder}'"
|
226
226
|
runOnce = true
|
227
|
+
when 'list files'
|
228
|
+
print 'Please enter the name of the folder you\'d like to observe (e.g. Awesome_Files/Pictures). >> '
|
229
|
+
folder = gets.chomp
|
230
|
+
Kernel.system "ls #{folder}"
|
231
|
+
puts "\r"
|
232
|
+
puts "I ran: 'ls #{folder}'"
|
233
|
+
runOnce = true
|
227
234
|
when 'create file'
|
228
235
|
print 'Please name your new file along with its directory (e.g. Documents/newfile.doc). >> '
|
229
236
|
file = gets.chomp
|
@@ -231,41 +238,18 @@ while exitis == 0 do
|
|
231
238
|
puts "\r"
|
232
239
|
puts "I ran: 'touch #{file}'"
|
233
240
|
runOnce = true
|
234
|
-
#The folowing code is broken for now. Disregard it.
|
235
|
-
=begin when 'change working folder'
|
236
|
-
print 'Please enter the name of the folder you like to switch to (e.g. Documents/Folder). >> '
|
237
|
-
folder = gets.chomp
|
238
|
-
Kernel.system "cd #{folder}"
|
239
|
-
puts "I ran: 'cd #{file}'"
|
240
|
-
|
241
|
-
when 'list files'
|
242
|
-
print 'Please enter the folder you\'d like to list files in (e.g. Documents). >> '
|
243
|
-
folder = gets.chomp
|
244
|
-
Kernel.system "ls #{folder} --color=auto"
|
245
|
-
puts "\r"
|
246
|
-
puts "I ran: 'ls #{folder}'"
|
247
|
-
=end
|
248
|
-
|
249
|
-
#The following code is broken for now. Disregard it.
|
250
|
-
=begin
|
251
|
-
when 'edit file'
|
252
|
-
print 'Please enter the name and location of the file you\'d like to edit (e.g. Documents/report.doc). >> '
|
253
|
-
file = gets.chomp
|
254
|
-
Kernel.system "nano #{file}"
|
255
|
-
puts "\r"
|
256
241
|
puts "I ran: 'nano #{file}'"
|
257
|
-
=end
|
258
242
|
when "compile"
|
259
|
-
print 'Please enter the location of the c++ code you\'d like to compile (e.g. Projects/helloworld.cpp). '
|
243
|
+
print 'Please enter the location of the c++ code you\'d like to compile (e.g. Projects/helloworld.cpp). >> '
|
260
244
|
code = gets.chomp
|
261
|
-
print 'Please enter the name you\'d like to give your compiled program. '
|
245
|
+
print 'Please enter the name you\'d like to give your compiled program. >> '
|
262
246
|
name = gets.chomp
|
263
247
|
Kernel.system "g++ -o #{name} #{code}"
|
264
248
|
puts "I ran: 'g++ -o #{name} #{code}'."
|
265
249
|
when "run c++ program"
|
266
|
-
print 'Please enter the folder your program is contained in (e.g. Documents, Projects/myfantsticproject, etc.). '
|
250
|
+
print 'Please enter the folder your program is contained in (e.g. Documents, Projects/myfantsticproject, etc.). >> '
|
267
251
|
folder = gets.chomp
|
268
|
-
print 'Please enter the name of your compiled program (e.g. helloworld, test, etc.). '
|
252
|
+
print 'Please enter the name of your compiled program (e.g. helloworld, test, etc.). >> '
|
269
253
|
program = gets.chomp
|
270
254
|
Kernel.system "#{folder}./#{program}"
|
271
255
|
when 'help'
|
@@ -283,9 +267,7 @@ while exitis == 0 do
|
|
283
267
|
["list files", "list all of the files in a given folder (e.g. Downloads)"],
|
284
268
|
["compile", "compiles a c++ file (e.g. foo.cpp)"],
|
285
269
|
["run c++ program", "runs a c++ program compiled with the aforementioned command"],
|
286
|
-
["exit", "exits ezbash"]
|
287
|
-
# puts "\t edit file: edits a text file in a bare-bones, quick editor (.rb, .html, .java, etc. count as text files)"
|
288
|
-
# puts "\r"
|
270
|
+
["exit", "exits ezbash"]]
|
289
271
|
puts PrettyTable.new(commands, headers).to_s
|
290
272
|
puts "\r"
|
291
273
|
when 'exit'
|