Top Level Namespace

Defined Under Namespace

Modules: Githelp

Instance Method Summary collapse

Instance Method Details

#files(force = false, argv = ARGV) ⇒ Object

見えるファイル名のリストを作る



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/githelp/files.rb', line 6

def files(force=false, argv=ARGV)
  #
  # 引数の中にファイル名とマッチするものがあればファイルリストを取得
  #
  list = begin
           `git ls-files`.split(/\n/)
         rescue
           []
         end
  matched = false
  list.each { |file|
    args.each { |arg|
      matched = true if file.match arg
    }
  }
  if (argv.length > 0 && matched) || force
    list
  else
    ['##DUMMYFILE##']
  end
end