dorian-git-tree 0.5.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/git-tree +26 -23
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aedd5baed50bded8a2697bd4c1f7f0668618ba3931024048fd8513f75a550825
|
4
|
+
data.tar.gz: 7ec98ad54a2d837f7d8b32e4cc83fab423b072ccbe784f7fb523c64dcec49d62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db7bd2dff7a976422eee9a5f981d45a42b0abbf19e2f92682bb40d9c37fa6fe9a7141c7bb2f3eef1d8692bd45337f998e8322ffc95e0498eca0db744171af601
|
7
|
+
data.tar.gz: 8763d8f59309cac4a5ace61424fdbd8300f0723f3f30c422968e842fe7fac32c1932df676d453e8bd634fa24c23d1bdf56a644ebc5db044fcc92f6636b514c9d
|
data/bin/git-tree
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "git"
|
5
|
+
require "dorian/arguments"
|
6
|
+
|
7
|
+
parsed = Dorian::Arguments.parse(version: { alias: :v }, help: { alias: :h })
|
8
|
+
|
9
|
+
abort parsed.help if parsed.options.help
|
10
|
+
|
11
|
+
if parsed.options.version
|
12
|
+
abort File.read(File.expand_path("../../VERSION", __FILE__))
|
13
|
+
end
|
5
14
|
|
6
15
|
SPACE = " "
|
7
16
|
RIGHT = "└── "
|
@@ -38,27 +47,21 @@ def print(key:, values:, index: 0, size: 1, prefix: "")
|
|
38
47
|
end
|
39
48
|
end
|
40
49
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
print(
|
59
|
-
key: value_key,
|
60
|
-
values: value_values,
|
61
|
-
index: value_index,
|
62
|
-
size: values.size
|
63
|
-
)
|
50
|
+
keys = parsed.arguments.any? ? parsed.arguments : ["."]
|
51
|
+
keys.each do |key|
|
52
|
+
files =
|
53
|
+
git_ls_files(key).map do |file|
|
54
|
+
parsed.arguments.any? ? file.sub(key, "") : file
|
55
|
+
end
|
56
|
+
values = group(files)
|
57
|
+
key = "#{key}/" if values.any? && key != "." && key[-1] != "/"
|
58
|
+
puts key
|
59
|
+
values.each.with_index do |(value_key, value_values), value_index|
|
60
|
+
print(
|
61
|
+
key: value_key,
|
62
|
+
values: value_values,
|
63
|
+
index: value_index,
|
64
|
+
size: values.size
|
65
|
+
)
|
66
|
+
end
|
64
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-git-tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dorian-arguments
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description: lists files and directories in git as a tree
|
28
42
|
email: dorian@dorianmarie.com
|
29
43
|
executables:
|