mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	bin help cleanup
This commit is contained in:
		| @@ -1,5 +1,7 @@ | |||||||
| #!/usr/bin/env ruby | #!/usr/bin/env ruby | ||||||
|  |  | ||||||
|  | $LOAD_PATH[0, 0] = File.join(File.dirname(__FILE__), '..', 'lib') | ||||||
|  |  | ||||||
| require 'linguist' | require 'linguist' | ||||||
| require 'rugged' | require 'rugged' | ||||||
| require 'optparse' | require 'optparse' | ||||||
| @@ -102,10 +104,16 @@ def git_linguist(args) | |||||||
|   commit = nil |   commit = nil | ||||||
|  |  | ||||||
|   parser = OptionParser.new do |opts| |   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("-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 |   end | ||||||
|  |  | ||||||
|   parser.parse!(args) |   parser.parse!(args) | ||||||
|   | |||||||
							
								
								
									
										21
									
								
								bin/linguist
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								bin/linguist
									
									
									
									
									
								
							| @@ -1,18 +1,22 @@ | |||||||
| #!/usr/bin/env ruby | #!/usr/bin/env ruby | ||||||
|  |  | ||||||
| # linguist — detect language type for a file, or, given a directory, determine language breakdown | $LOAD_PATH[0, 0] = File.join(File.dirname(__FILE__), '..', 'lib') | ||||||
| #     usage: linguist <path> [<--breakdown>] |  | ||||||
| # |  | ||||||
| require 'linguist' | require 'linguist' | ||||||
| require 'rugged' | require 'rugged' | ||||||
| require 'json' | require 'json' | ||||||
|  | require 'optparse' | ||||||
|  |  | ||||||
| path = ARGV[0] || Dir.pwd | 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" | if path == "--breakdown" | ||||||
|   path = Dir.pwd |   path = Dir.pwd | ||||||
|   breakdown = true |   breakdown = true | ||||||
|  | elsif path == "--json" | ||||||
|  |   path = Dir.pwd | ||||||
|  |   json_breakdown = true | ||||||
| end | end | ||||||
|  |  | ||||||
| ARGV.shift | ARGV.shift | ||||||
| @@ -69,5 +73,12 @@ elsif File.file?(path) | |||||||
|     puts "  appears to be a vendored file" |     puts "  appears to be a vendored file" | ||||||
|   end |   end | ||||||
| else | 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 | end | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user