mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 01:30:22 +00:00
bin help cleanup
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
$LOAD_PATH[0, 0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
|
||||
require 'linguist'
|
||||
require 'rugged'
|
||||
require 'optparse'
|
||||
@@ -102,10 +104,16 @@ def git_linguist(args)
|
||||
commit = nil
|
||||
|
||||
parser = OptionParser.new do |opts|
|
||||
opts.banner = "Usage: git-linguist [OPTIONS] stats|breakdown|dump-cache|clear|disable"
|
||||
opts.banner = <<-HELP
|
||||
Linguist v#{Linguist::VERSION}
|
||||
Detect language type and determine language breakdown for a given Git repository.
|
||||
|
||||
Usage:
|
||||
git-linguist [OPTIONS] stats|breakdown|dump-cache|clear|disable"
|
||||
HELP
|
||||
|
||||
opts.on("-f", "--force", "Force a full rescan") { incremental = false }
|
||||
opts.on("--commit=COMMIT", "Commit to index") { |v| commit = v}
|
||||
opts.on("-c", "--commit=COMMIT", "Commit to index") { |v| commit = v}
|
||||
end
|
||||
|
||||
parser.parse!(args)
|
||||
|
||||
21
bin/linguist
21
bin/linguist
@@ -1,18 +1,22 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# linguist — detect language type for a file, or, given a directory, determine language breakdown
|
||||
# usage: linguist <path> [<--breakdown>]
|
||||
#
|
||||
$LOAD_PATH[0, 0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
|
||||
require 'linguist'
|
||||
require 'rugged'
|
||||
require 'json'
|
||||
require 'optparse'
|
||||
|
||||
path = ARGV[0] || Dir.pwd
|
||||
|
||||
# special case if not given a directory but still given the --breakdown option
|
||||
# special case if not given a directory
|
||||
# but still given the --breakdown or --json options/
|
||||
if path == "--breakdown"
|
||||
path = Dir.pwd
|
||||
breakdown = true
|
||||
elsif path == "--json"
|
||||
path = Dir.pwd
|
||||
json_breakdown = true
|
||||
end
|
||||
|
||||
ARGV.shift
|
||||
@@ -69,5 +73,12 @@ elsif File.file?(path)
|
||||
puts " appears to be a vendored file"
|
||||
end
|
||||
else
|
||||
abort "usage: linguist <path>"
|
||||
abort <<-HELP
|
||||
Linguist v#{Linguist::VERSION}
|
||||
Detect language type for a file, or, given a directory, determine language breakdown.
|
||||
|
||||
Usage: linguist <path>
|
||||
linguist <path> [--breakdown] [--json]
|
||||
linguist [--breakdown] [--json]
|
||||
HELP
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user