(licenseTemplate *api.GitIgnore, opts *ViewOptions)
| 100 | } |
| 101 | |
| 102 | func renderGitIgnore(licenseTemplate *api.GitIgnore, opts *ViewOptions) error { |
| 103 | // I wanted to render this in a markdown code block and benefit |
| 104 | // from .gitignore syntax highlighting. But, the upstream syntax highlighter |
| 105 | // does not currently support .gitignore. |
| 106 | // So, I just add a newline and print the content as is instead. |
| 107 | // Ref: https://github.com/alecthomas/chroma/pull/755 |
| 108 | var out strings.Builder |
| 109 | if opts.IO.IsStdoutTTY() { |
| 110 | out.WriteString("\n") |
| 111 | } |
| 112 | out.WriteString(licenseTemplate.Source) |
| 113 | _, err := opts.IO.Out.Write([]byte(out.String())) |
| 114 | if err != nil { |
| 115 | return err |
| 116 | } |
| 117 | return nil |
| 118 | } |
no test coverage detected