File tree 2 files changed +18
-5
lines changed
2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 2
2
3
3
class Gel ::Command ::Env < Gel ::Command
4
4
def run ( command_line )
5
- MarkdownFormatter . format ( metadata )
5
+ option = { full : ( command_line . shift == "--full" ) }
6
+ data = metadata ( option )
7
+ MarkdownFormatter . format ( data )
6
8
end
7
9
8
10
private
9
11
10
- def metadata
11
- {
12
+ def metadata ( option )
13
+ metadata = {
12
14
"Gel" => gel_envs ,
13
15
"User" => user_envs ,
14
16
"Ruby" => ruby_envs ,
15
- "Relevant Files" => RELEVANT_FILES ,
16
17
}
18
+ if option [ :full ]
19
+ metadata . merge! ( "Relevant Files" => RELEVANT_FILES )
20
+ end
21
+ metadata
17
22
end
18
23
19
24
module MarkdownFormatter
Original file line number Diff line number Diff line change 3
3
require "test_helper"
4
4
5
5
class EnvTest < Minitest ::Test
6
- def test_help
6
+ def test_env
7
7
output = capture_stdout { Gel ::Command ::Env . run ( [ "env" ] ) }
8
8
9
+ assert output =~ %r{## Gel}
10
+ assert output =~ %r{## User}
11
+ assert output =~ %r{## Ruby}
12
+ end
13
+
14
+ def test_env_with_full
15
+ output = capture_stdout { Gel ::Command ::Env . run ( [ "env" , "--full" ] ) }
16
+
9
17
assert output =~ %r{## Gel}
10
18
assert output =~ %r{## User}
11
19
assert output =~ %r{## Ruby}
You can’t perform that action at this time.
0 commit comments