dumb_down_viewer 0.1.0 → 0.1.1
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/.travis.yml +1 -0
- data/README.md +4 -4
- data/dumb_down_viewer.gemspec +2 -2
- data/lib/dumb_down_viewer.rb +8 -1
- data/lib/dumb_down_viewer/cli.rb +4 -4
- data/lib/dumb_down_viewer/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd7eace0d8800abaab20ba3e1164b0b8d4daed9f
|
4
|
+
data.tar.gz: da3eb4bc5fbc02efe68c72e7e6f19df3828ad85b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86c63e2182329a549dd09b57bcd5f8e777b93bdbb8b8501c99b6c7731a39ac9751d8546004193ae062ed8146a540b8458b10093885dc140e8c189ac0273b6735
|
7
|
+
data.tar.gz: 13c5a5f35464ca254670644e14824f0041f6684aef2f7bf54d1d151a4e10bdee2225fe70617c70761d48b10fd8c310022fbfde13b516df16a9a7427fa929e087
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
DumbDownViewer (ddv) is a recursive directory listing command with limited functionality.
|
4
4
|
|
5
|
-
In some
|
5
|
+
In some cases, you can use ddv like "[tree](http://mama.indstate.edu/users/ice/tree/)" command, even though these commands are not compatible:
|
6
6
|
|
7
|
-
Several options of "tree" are missing in ddv,
|
7
|
+
Several options of "tree" are missing in ddv. On the other hand, there are some options that are available only in ddv (such as --copy-to).
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -47,7 +47,7 @@ Suppose you have a directory `spec/data`
|
|
47
47
|
spec/data/aves/cannot_fly/ostrich.jpg
|
48
48
|
|
49
49
|
|
50
|
-
Then type at the command line (
|
50
|
+
Then type the following at the command line (you may replace `spec/data` with a directory name which is on your system):
|
51
51
|
|
52
52
|
$ ddv spec/data
|
53
53
|
|
@@ -79,7 +79,7 @@ The following is the list of available options:
|
|
79
79
|
|Short |Long |Description |
|
80
80
|
|------|-----|------------|
|
81
81
|
|-s [style_name] |--style [=style_name] |Choose the style of output other than default from ascii_art, list, zenkaku or tree |
|
82
|
-
|-f [format_name] |--format [=format_name] |Choose the output format other than default from csv, tsv or
|
82
|
+
|-f [format_name] |--format [=format_name] |Choose the output format other than default from csv, tsv, tree_csv, json or xml |
|
83
83
|
|-d |--directories-only |List directories only |
|
84
84
|
|-L [level] |- |Descend only level directories deep |
|
85
85
|
|-P [pattern] |- |List only those files that match the given pattern |
|
data/dumb_down_viewer.gemspec
CHANGED
@@ -12,9 +12,9 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.summary = %q{DumbDownViewer (ddv) is a recursive directory listing command with limited functionality.}
|
13
13
|
spec.description = <<-DESCRIPTION
|
14
14
|
DumbDownViewer (ddv) is a recursive directory listing command with limited functionality.
|
15
|
-
In some
|
15
|
+
In some cases, you can use ddv like "tree" command (http://mama.indstate.edu/users/ice/tree/),
|
16
16
|
even though these commands are not compatible: Several options of "tree" are missing in ddv,
|
17
|
-
but there are
|
17
|
+
but there are some options that are available only in ddv (such as --copy-to) too.
|
18
18
|
DESCRIPTION
|
19
19
|
spec.homepage = "https://github.com/nico-hn/DumbDownViewer"
|
20
20
|
spec.license = "MIT"
|
data/lib/dumb_down_viewer.rb
CHANGED
@@ -4,6 +4,12 @@ require 'find'
|
|
4
4
|
require 'nokogiri'
|
5
5
|
|
6
6
|
module DumbDownViewer
|
7
|
+
class << self
|
8
|
+
attr_reader :filesystem_encoding
|
9
|
+
end
|
10
|
+
|
11
|
+
@filesystem_encoding = Encoding.find('locale')
|
12
|
+
|
7
13
|
def self.collect_directories_and_files(path)
|
8
14
|
entries = Dir.entries(path) - ['.', '..']
|
9
15
|
entries.partition do |entry|
|
@@ -23,7 +29,7 @@ module DumbDownViewer
|
|
23
29
|
|
24
30
|
def initialize(pwd, name, depth)
|
25
31
|
@directory = pwd
|
26
|
-
@name = name
|
32
|
+
@name = name.encode(Encoding::UTF_8)
|
27
33
|
@depth = depth
|
28
34
|
@name_with_path = pwd.empty? ? @name : File.join(pwd, name)
|
29
35
|
setup
|
@@ -66,6 +72,7 @@ module DumbDownViewer
|
|
66
72
|
|
67
73
|
def entry_nodes(nodes, node_class, depth)
|
68
74
|
nodes.map {|node| node_class.new(@name_with_path, node, depth) }
|
75
|
+
.sort_by {|node| node.name }
|
69
76
|
end
|
70
77
|
end
|
71
78
|
|
data/lib/dumb_down_viewer/cli.rb
CHANGED
@@ -20,7 +20,7 @@ style:
|
|
20
20
|
format:
|
21
21
|
short: "-f [format_name]"
|
22
22
|
long: "--format [=format_name]"
|
23
|
-
description: Choose the output format other than default from csv, tsv, tree_csv
|
23
|
+
description: Choose the output format other than default from csv, tsv, tree_csv, json or xml
|
24
24
|
directories:
|
25
25
|
short: "-d"
|
26
26
|
long: "--directories-only"
|
@@ -93,7 +93,7 @@ YAML
|
|
93
93
|
|
94
94
|
def self.execute
|
95
95
|
options = parse_command_line_options
|
96
|
-
tree = DumbDownViewer.build_node_tree(ARGV[0])
|
96
|
+
tree = DumbDownViewer.build_node_tree(ARGV[0] || '.')
|
97
97
|
prune_dot_files(tree) unless options[:show_all]
|
98
98
|
prune_dirs_with_more_than(tree, options[:file_limit]) if options[:file_limit]
|
99
99
|
prune_level(tree, options[:level]) if options[:level]
|
@@ -166,9 +166,9 @@ YAML
|
|
166
166
|
def self.format_tree(tree, options)
|
167
167
|
if options[:file_limit] and tree.sub_nodes.empty?
|
168
168
|
''
|
169
|
-
elsif options[:json]
|
169
|
+
elsif options[:json] or options[:format] == :json
|
170
170
|
format_json(tree, options)
|
171
|
-
elsif options[:xml]
|
171
|
+
elsif options[:xml] or options[:format] == :xml
|
172
172
|
format_xml(tree, options)
|
173
173
|
else
|
174
174
|
format_tree_with_builder(tree, options)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dumb_down_viewer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HASHIMOTO, Naoki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -82,9 +82,9 @@ dependencies:
|
|
82
82
|
version: '3.0'
|
83
83
|
description: |
|
84
84
|
DumbDownViewer (ddv) is a recursive directory listing command with limited functionality.
|
85
|
-
In some
|
85
|
+
In some cases, you can use ddv like "tree" command (http://mama.indstate.edu/users/ice/tree/),
|
86
86
|
even though these commands are not compatible: Several options of "tree" are missing in ddv,
|
87
|
-
but there are
|
87
|
+
but there are some options that are available only in ddv (such as --copy-to) too.
|
88
88
|
email:
|
89
89
|
- hashimoto.naoki@gmail.com
|
90
90
|
executables:
|