filechooser 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/filechooser/api.rb +11 -14
- data/lib/filechooser.rb +1 -1
- 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: d623500436378adedefca60d8b1e98a2419191a7
|
4
|
+
data.tar.gz: 8c8f7adb2ecbf489894e5b12213d02e985b7baaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f6bfd4c54e63a84f3cfcb7eed15b050ad0aa1fc527828dd3ce0fca0715bb00d1f57d90d41699309a4e3d1545981e5807c2cfea58b4536adfff21507a04eaab9
|
7
|
+
data.tar.gz: 4c0ecf9f4db87c51d94921e4556bb19b3196f33273fb36b5ed44945a53ad3efcfa04e52359f38a6df3af54f284c7d69cb0291cf89f31587ec2f6b02ab451aec6
|
data/lib/filechooser/api.rb
CHANGED
@@ -5,13 +5,7 @@ module Filechooser
|
|
5
5
|
def self.dirchooser(startfolder=STARTFOLDER)
|
6
6
|
p0 = Pathname.new(startfolder)
|
7
7
|
while true
|
8
|
-
|
9
|
-
sd=p0.children.select(&:directory?).length
|
10
|
-
f=p0.children.select(&:file?).length
|
11
|
-
Highline.cli.say("(#{sd} directories, #{f} files)".style(":info"))
|
12
|
-
choices= "(C)hoose (D)own (U)p (N)ew E(x)it ? "
|
13
|
-
answer = Highline.cli.ask(choices.style(":ask_line")) {|q| q.character = true}
|
14
|
-
case answer
|
8
|
+
case get_answer(p0)
|
15
9
|
when /[cC]/ then return p0.to_s
|
16
10
|
when /[xX]/ then return ''
|
17
11
|
when /[dD]/ then Highline.cli.say("Subdirectories of #{p0}:".style(":info"))
|
@@ -52,13 +46,7 @@ module Filechooser
|
|
52
46
|
def self.filechooser(startfolder=STARTFOLDER)
|
53
47
|
p0 = Pathname.new(startfolder)
|
54
48
|
while true
|
55
|
-
|
56
|
-
sd=p0.children.select(&:directory?).length
|
57
|
-
f=p0.children.select(&:file?).length
|
58
|
-
Highline.cli.say("(#{sd} directories, #{f} files)".style(":info"))
|
59
|
-
choices= "(C)hoose (D)own (U)p (N)ew E(x)it ? "
|
60
|
-
answer = Highline.cli.ask(choices.style(":ask_line")) {|q| q.character = true}
|
61
|
-
case answer
|
49
|
+
case get_answer(p0)
|
62
50
|
when /[cC]/ then Highline.cli.say("Files of #{p0}:".style(":info"))
|
63
51
|
datei=choose_datei(p0)
|
64
52
|
if datei==''
|
@@ -107,6 +95,15 @@ module Filechooser
|
|
107
95
|
|
108
96
|
end
|
109
97
|
|
98
|
+
def self.get_answer(p0)
|
99
|
+
Highline.cli.say("Current Directory: #{p0}".style(":info"))
|
100
|
+
sd=unterverzeichnisse(p0).length # p0.children.select(&:directory?).length would count hidden folders too
|
101
|
+
f=dateien(p0).length
|
102
|
+
Highline.cli.say("(#{sd} directories, #{f} files)".style(":info"))
|
103
|
+
choices= "(C)hoose (D)own (U)p (N)ew E(x)it ? "
|
104
|
+
answer = Highline.cli.ask(choices.style(":ask_line")) {|q| q.character = true}
|
105
|
+
end
|
106
|
+
|
110
107
|
|
111
108
|
def self.choose_uvz(vz) # returns chosen subdirectory of vz
|
112
109
|
a=unterverzeichnisse(vz)
|
data/lib/filechooser.rb
CHANGED