explain_output.ex (1388B)
1 defmodule Credo.CLI.Command.Explain.ExplainOutput do 2 @moduledoc false 3 4 alias Credo.CLI.Output.UI 5 6 use Credo.CLI.Output.FormatDelegator, 7 default: Credo.CLI.Command.Explain.Output.Default, 8 json: Credo.CLI.Command.Explain.Output.Json 9 10 def print_help(exec) do 11 usage = [ 12 "Usage: ", 13 :olive, 14 "mix credo explain <check_name_or_path_line_no_column> [options]" 15 ] 16 17 description = """ 18 19 Explain the given check or issue. 20 """ 21 22 example = [ 23 "Examples:\n", 24 :olive, 25 " $ mix credo explain lib/foo/bar.ex:13:6\n", 26 " $ mix credo explain lib/foo/bar.ex:13:6 --format json\n", 27 " $ mix credo explain Credo.Check.Refactor.Nesting" 28 ] 29 30 options = 31 """ 32 33 Explain options: 34 --format Display the list in a specific format (json,flycheck,oneline) 35 36 General options: 37 --[no-]color Toggle colored output 38 -v, --version Show version 39 -h, --help Show this help 40 41 Find advanced usage instructions and more examples here: 42 https://hexdocs.pm/credo/explain_command.html 43 44 Give feedback and open an issue here: 45 https://github.com/rrrene/credo/issues 46 """ 47 |> String.trim_trailing() 48 49 UI.puts() 50 UI.puts(usage) 51 UI.puts(description) 52 UI.puts(example) 53 UI.puts(options) 54 55 exec 56 end 57 end