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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68ddb105d2212da095c7ba73bd66fa30ee4b9bf2
4
- data.tar.gz: fc6a44d25b4f9fc7c54800c661c44a83635083cd
3
+ metadata.gz: b158c204c274afddb4a832eeb6263fad33afec65
4
+ data.tar.gz: 4d370e28df53cacb9dd05e849e633c1d06830346
5
5
  SHA512:
6
- metadata.gz: 7e9d7bd3dfa7b0411bb331ecb87469a14d4deae0e08d34c64cd6ae9a9df961f21b9ff8e412b926aab33909f108ffa30b86134d927933d6daa3eb8859e3440bc3
7
- data.tar.gz: 2565707312db7b178ea38fcc0427b7e88deb21c8773f319bd32ffd204d6f4fd523c1f4b3d2ab3e21c6478e7eb0477310aed89dafc8a4e5a1e8ed363e4e14a59e
6
+ metadata.gz: 27d7b5971720e54a42128236ded820271bc4c414cd5bd52d3845a4949ce67a5a9b37ae61a3b66157de9cd168216b0306712e8e4607419f36fcab7e20f84de38e
7
+ data.tar.gz: f52c088fa5d89ff2b510ed137ae9631b640f1acb7fd190e0476375f1ef36cf507ef3407919fc584e2b6283eb610574dd81838f913694267f6b243bf4a7e71b9c
@@ -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 "## #{headline}" if i == 0
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 "<h2>#{headline}</h2>"
35
+ puts "<h#{headline_level}>#{headline}</h#{headline_level}>"
35
36
  puts '<ul>'
36
37
  end
37
38
  puts " <li>#{row}</li>"
@@ -1,3 +1,3 @@
1
1
  module Showlog
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: showlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - foostan