From 69b6a7816ba4f27d27e4ddec075cef7f25a9c909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Navarro?= Date: Tue, 1 Oct 2019 09:45:43 +0200 Subject: [PATCH] Listing the levels, it show the solved levels in green and the pending ones in red. (#264) --- lib/githug/cli.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/githug/cli.rb b/lib/githug/cli.rb index 36e165a0..6b5e4b82 100644 --- a/lib/githug/cli.rb +++ b/lib/githug/cli.rb @@ -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