sbag 0.1.6 → 0.2.0
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/lib/sbag/version.rb +1 -1
- data/lib/sbag.rb +59 -22
- 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: 1435cfd498935176f988eeb568a71907d67b8bb0
|
4
|
+
data.tar.gz: 53c3d0fb18b40094dd028da76990cbbed4cc060f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d63d4e9ccf13c5b126a9469f1b4835aaf2507695347e3c2dd7643c0b14a621590eb312334033a01451333f3ec8349b3d80b5b342cb3d69667caff3173788a669
|
7
|
+
data.tar.gz: 18053bb244a4d69ac5261a7993c0ad729ec6810aad3dbb87e56bd5536a292598b19943fa750251cb4dc5bb1f75113f527cc60863b0c37c2b94e60528f0d75c26
|
data/lib/sbag/version.rb
CHANGED
data/lib/sbag.rb
CHANGED
@@ -4,32 +4,69 @@ require "colorize"
|
|
4
4
|
module Sbag
|
5
5
|
|
6
6
|
class C < Thor
|
7
|
+
#New File Command =====================================>>>
|
8
|
+
desc "newfile", "Create a new file"
|
9
|
+
method_option :newfile, :aliases => "-c" , :desc => "Use newfile command to create new file. Usage: [file_name].[file_extension]"
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
#Delete Command
|
18
|
-
desc "delete", "Delete the existing file"
|
19
|
-
method_option :delete, :aliases => "-d", :desc => "Use create command to delete existing file. Usage: [file_name].[file_extension]"
|
11
|
+
def newfile(file)
|
12
|
+
new_file = File.new("#{file}","w+")
|
13
|
+
puts "New file created => *#{file}*".green
|
14
|
+
end
|
15
|
+
#========================END===============================#
|
16
|
+
#Delete File Command =====================================>>>
|
17
|
+
desc "delfile", "Delete the existing file"
|
18
|
+
method_option :delfile, :aliases => "-d", :desc => "Use delfile command to delete existing file. Usage: [file_name].[file_extension]"
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
#Time Command
|
20
|
+
def delfile(file)
|
21
|
+
File.delete("#{file}")
|
22
|
+
puts "Existing file deleted => *#{file}*".green
|
23
|
+
end
|
24
|
+
#========================END===============================#
|
25
|
+
#Time Display Command =====================================>>>
|
27
26
|
desc "time" , "Display current time"
|
28
27
|
method_option :time, :aliases => "-t", :desc => "Use time command to display the current time"
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
def time
|
30
|
+
time = Time.now
|
31
|
+
puts "Current time => *#{time}*".green
|
32
|
+
end
|
33
|
+
#========================END===============================#
|
34
|
+
#Current Location Command =====================================>>>
|
35
|
+
desc "locate", "Current directory or folder path"
|
36
|
+
method_option :locate, :aliases => "-loc", :desc => "Use locate command to find the current directory or folder path"
|
37
|
+
|
38
|
+
def locate
|
39
|
+
location = Dir.pwd
|
40
|
+
puts "Current Location => *#{location}*".green
|
41
|
+
end
|
42
|
+
#========================END===============================#
|
43
|
+
#Make new Directory Command =====================================>>>
|
44
|
+
desc "newdir", "Create a new directory or folder"
|
45
|
+
method_option :newdir, :aliases => "-nd", :desc => "Use newdir command to create a new directory or folder in the current path"
|
46
|
+
|
47
|
+
def newdir(new_dir)
|
48
|
+
Dir.mkdir("#{new_dir}")
|
49
|
+
location = Dir.pwd
|
50
|
+
puts "New Directory created => *#{new_dir}* at *#{location}*".green
|
51
|
+
end
|
52
|
+
#========================END===============================#
|
53
|
+
#Directory Listing Command =====================================>>>
|
54
|
+
desc "entries", "Files and directory Listing Command"
|
55
|
+
method_option :entries, :aliases => "-entries", :desc => "Use entries command to list all the files and directories in current path"
|
56
|
+
|
57
|
+
def entries
|
58
|
+
location = Dir.pwd
|
59
|
+
puts Dir.entries("#{location}").green
|
60
|
+
end
|
61
|
+
#========================END===============================#
|
62
|
+
#Delete Directory Command =====================================>>>
|
63
|
+
desc "deldir", "Delete directory or folder Command"
|
64
|
+
method_option :deldir, :aliases => "-ddir", :desc => "Use deldir command to delete the folder and directory in current path"
|
65
|
+
|
66
|
+
def deldir(del_dir)
|
67
|
+
Dir.delete("#{del_dir}")
|
68
|
+
puts "Deleted directory => *#{del_dir}*".green
|
69
|
+
end
|
70
|
+
#========================END===============================#
|
33
71
|
end
|
34
72
|
end
|
35
|
-
end
|