File tree Expand file tree Collapse file tree 1 file changed +1
-48
lines changed
Expand file tree Collapse file tree 1 file changed +1
-48
lines changed Original file line number Diff line number Diff line change @@ -111,54 +111,7 @@ def self.for_file(argv)
111111 raise "Please pass in one file. Use `#{ EXECUTABLE } for_file --help` for more info"
112112 end
113113
114- if options [ :verbose ]
115- for_file_verbose ( file : files . first , json : options [ :json ] )
116- else
117- for_file_terse ( file : files . first , json : options [ :json ] )
118- end
119- end
120-
121- def self . for_file_terse ( file :, json :)
122- team = CodeOwnership . for_file ( file )
123-
124- team_name = team &.name || 'Unowned'
125- team_yml = team &.config_yml || 'Unowned'
126-
127- if json
128- json_output = {
129- team_name : team_name ,
130- team_yml : team_yml
131- }
132-
133- puts json_output . to_json
134- else
135- puts <<~MSG
136- Team: #{ team_name }
137- Team YML: #{ team_yml }
138- MSG
139- end
140- end
141-
142- def self . for_file_verbose ( file :, json :)
143- verbose = CodeOwnership . for_file_verbose ( file ) || { team_name : 'Unowned' , team_config_yml : 'Unowned' , reasons : [ ] }
144-
145- if json
146- json = {
147- team_name : verbose [ :team_name ] ,
148- team_yml : verbose [ :team_config_yml ] ,
149- reasons : verbose [ :reasons ]
150- }
151-
152- puts json . to_json
153- else
154- messages = [ "Team: #{ verbose [ :team_name ] } " , "Team YML: #{ verbose [ :team_config_yml ] } " ]
155- if verbose [ :reasons ] . any?
156- messages << "Reasons:\n - #{ verbose [ :reasons ] . join ( "\n -" ) } "
157- end
158- messages . last << "\n "
159-
160- puts messages . join ( "\n " )
161- end
114+ puts CodeOwnership ::Private ::ForFileOutputBuilder . build ( file_path : files . first , json : !!options [ :json ] , verbose : !!options [ :verbose ] )
162115 end
163116
164117 def self . for_team ( argv )
You can’t perform that action at this time.
0 commit comments