Skip to content

Commit

Permalink
Listing the levels, it show the solved levels in green and the pendin…
Browse files Browse the repository at this point in the history
…g ones in red. (#264)
  • Loading branch information
VictorMNA authored and Gazler committed Oct 1, 2019
1 parent 2db7ee6 commit 69b6a78
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/githug/cli.rb
Expand Up @@ -54,13 +54,21 @@ def reset(path = nil)
end
end

desc :levels, "List all of the levels"
desc :levels, "List all of the levels (green passed, red pending)"

def levels
list_with_numbers = Level.list.each_with_index.map do |name, index|
"##{index + 1}: #{name}"
level = load_level_from_profile
pending = false
Level.list.each_with_index.map do |name, index|
if index + 1 == level.level_no
pending = true
end
if !pending
UI.success("##{index + 1}: #{name}")
else
UI.error("##{index + 1}: #{name}")
end
end
UI.puts(list_with_numbers)
end

no_tasks do
Expand Down

0 comments on commit 69b6a78

Please sign in to comment.