showlog 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/showlog/cli.rb +5 -4
- data/lib/showlog/version.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: b158c204c274afddb4a832eeb6263fad33afec65
|
4
|
+
data.tar.gz: 4d370e28df53cacb9dd05e849e633c1d06830346
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27d7b5971720e54a42128236ded820271bc4c414cd5bd52d3845a4949ce67a5a9b37ae61a3b66157de9cd168216b0306712e8e4607419f36fcab7e20f84de38e
|
7
|
+
data.tar.gz: f52c088fa5d89ff2b510ed137ae9631b640f1acb7fd190e0476375f1ef36cf507ef3407919fc584e2b6283eb610574dd81838f913694267f6b243bf4a7e71b9c
|
data/lib/showlog/cli.rb
CHANGED
@@ -8,22 +8,23 @@ module Showlog
|
|
8
8
|
option :since, aliases: :s, default: '1.days.ago'
|
9
9
|
option :author, aliases: :a, default: `whoami`
|
10
10
|
option :format, aliases: :f, default: 'noformat'
|
11
|
+
option :headline_level, aliases: :l, default: 2
|
11
12
|
|
12
13
|
def git
|
13
14
|
Dir.glob(File.expand_path(options[:path]) + '/**/.git', File::FNM_DOTMATCH).each do |git_dir|
|
14
15
|
repo_dir = File.dirname(git_dir)
|
15
16
|
git_log = `cd #{repo_dir}; git log --pretty=format:"%h %ad:%d:%s" --date=local --reverse --all --since=#{options[:since]} --author="#{options[:author]}" 2>/dev/null`.split("\n")
|
16
|
-
show_log(repo_dir, git_log, options[:format])
|
17
|
+
show_log(repo_dir, git_log, options[:format], options[:headline_level])
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
20
21
|
private
|
21
22
|
|
22
|
-
def show_log(headline, log, format = 'noformat')
|
23
|
+
def show_log(headline, log, format = 'noformat', headline_level = 2)
|
23
24
|
case format
|
24
25
|
when 'markdown'
|
25
26
|
log.each_with_index do |row, i|
|
26
|
-
puts "
|
27
|
+
puts "#{'#' * headline_level.to_i} #{headline}" if i == 0
|
27
28
|
puts "- #{row}"
|
28
29
|
puts '' if i == log.length - 1
|
29
30
|
end
|
@@ -31,7 +32,7 @@ module Showlog
|
|
31
32
|
when 'html'
|
32
33
|
log.each_with_index do |row, i|
|
33
34
|
if i == 0
|
34
|
-
puts "<
|
35
|
+
puts "<h#{headline_level}>#{headline}</h#{headline_level}>"
|
35
36
|
puts '<ul>'
|
36
37
|
end
|
37
38
|
puts " <li>#{row}</li>"
|
data/lib/showlog/version.rb
CHANGED