Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
438814e
commit 6fb8b00
Showing
6 changed files
with
111 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
require 'cucumber/formatter/pretty' | ||
|
||
module Cucumber | ||
module Cli2 | ||
class LanguageHelpFormatter < Formatter::Pretty | ||
INCOMPLETE = %{ | ||
This language is incomplete. Please translate the missing words in | ||
#{Cucumber::LANGUAGE_FILE} | ||
Then contribute back to the Cucumber project. Details here: | ||
http://wiki.github.com/aslakhellesoy/cucumber/spoken-languages | ||
} | ||
|
||
def self.list_languages(io) | ||
raw = Cucumber::LANGUAGES.keys.sort.map do |lang| | ||
[lang, Cucumber::LANGUAGES[lang]['name'], Cucumber::LANGUAGES[lang]['native']] | ||
end | ||
table = Ast::Table.new(raw) | ||
new(nil, io, {:check_lang=>true}, '').visit_multiline_arg(table, :passed) | ||
end | ||
|
||
def self.list_keywords(io, lang) | ||
Cucumber.load_language(lang) | ||
raw = Cucumber::KEYWORD_KEYS.map do |key| | ||
[key, Cucumber::LANGUAGES[lang][key]] | ||
end | ||
table = Ast::Table.new(raw) | ||
new(nil, io, {:incomplete => Cucumber.language_incomplete?}, '').visit_multiline_arg(table, :passed) | ||
end | ||
|
||
def visit_multiline_arg(table, status) | ||
if @options[:incomplete] | ||
@io.puts(format_string(INCOMPLETE, :failed)) | ||
end | ||
super | ||
end | ||
|
||
def visit_table_row(table_row, status) | ||
@col = 1 | ||
super | ||
end | ||
|
||
def visit_table_cell_value(value, width, status) | ||
if @col == 1 | ||
if(@options[:check_lang]) | ||
@incomplete = Cucumber.language_incomplete?(value) | ||
end | ||
status = :comment | ||
elsif @incomplete | ||
status = :failed | ||
end | ||
|
||
@col += 1 | ||
super(value, width, status) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.