very_safe_rm 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/very_safe_rm +1 -1
- data/lib/very_safe_rm.rb +1 -11
- data/lib/very_safe_rm/args.rb +22 -0
- data/lib/very_safe_rm/rm_one.rb +1 -0
- data/lib/very_safe_rm/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 022a223eeb6885bae20e56962b06358c041f130a
|
4
|
+
data.tar.gz: 8253a54c8e105cdfd72bcc796f23b1bbec27b60d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20b869a70a4f9caacc2b646597068dfe51a6ad95d02b78ea2a38ff330bd97b201f0fd7c7a1b2985d2e78e747f41f99aefa16759d0c60b90c8e2eb2b8efc74009
|
7
|
+
data.tar.gz: 5351867517f862208b4427489bd8c3be7e553d9cfc9949a872c292ae316d67cef741908873f1939e1b477e96f2c3f66c53f8732ee44a3ad3b41009cdba9a1017
|
data/exe/very_safe_rm
CHANGED
data/lib/very_safe_rm.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'very_safe_rm/version'
|
2
2
|
require 'very_safe_rm/rm_one'
|
3
|
+
require 'very_safe_rm/args'
|
3
4
|
|
4
5
|
# TODO
|
5
6
|
module VerySafeRm
|
@@ -8,15 +9,4 @@ module VerySafeRm
|
|
8
9
|
RM.rm_one name, args
|
9
10
|
end
|
10
11
|
end
|
11
|
-
|
12
|
-
def self.parse(argv)
|
13
|
-
a = argv.each_with_object(file: [], args: [], done: false) do |arg, obj|
|
14
|
-
if obj[:done] then obj[:file] << arg
|
15
|
-
elsif arg == '--' then obj[:done] = true
|
16
|
-
elsif arg[0] == '-' then obj[:args] << arg
|
17
|
-
else obj[:file] << arg
|
18
|
-
end
|
19
|
-
end
|
20
|
-
[a[:file], a[:args]]
|
21
|
-
end
|
22
12
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module VerySafeRm
|
2
|
+
module Arg
|
3
|
+
def self.parse(argv)
|
4
|
+
a = argv.each_with_object(file: [], args: [], done: false) do |arg, obj|
|
5
|
+
if obj[:done] then obj[:file] << arg
|
6
|
+
elsif arg == '--' then obj[:done] = true
|
7
|
+
elsif arg[0] == '-' then obj[:args].push(*Arg.arg(arg))
|
8
|
+
else obj[:file] << arg
|
9
|
+
end
|
10
|
+
end
|
11
|
+
[a[:file], a[:args]]
|
12
|
+
end
|
13
|
+
|
14
|
+
private_class_method
|
15
|
+
|
16
|
+
def self.arg(arg)
|
17
|
+
return [] unless arg[0] == '-'
|
18
|
+
return [arg] if arg[1] == '-'
|
19
|
+
arg[1..-1].each_char.each_with_object([]) { |a, obj| obj << "-#{a}" }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/very_safe_rm/rm_one.rb
CHANGED
data/lib/very_safe_rm/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: very_safe_rm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 71e6fd52
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- bin/setup
|
73
73
|
- exe/very_safe_rm
|
74
74
|
- lib/very_safe_rm.rb
|
75
|
+
- lib/very_safe_rm/args.rb
|
75
76
|
- lib/very_safe_rm/rm_one.rb
|
76
77
|
- lib/very_safe_rm/version.rb
|
77
78
|
- very_safe_rm.gemspec
|