Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List formatters in help command #1798

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9daa87e
feature/list-formatters-in-help-command adding documentation field to…
TomerPacific Sep 16, 2021
96e30e5
feature/list-formatters-in-help-command refactoring getConstructorByT…
TomerPacific Sep 16, 2021
a76f231
feature/list-formatters-in-help-command improving return statement to…
TomerPacific Sep 16, 2021
ced6ecc
feature/list-formatters-in-help-command after running lint fix
TomerPacific Sep 17, 2021
4c89fea
feature/list-formatters-in-help-command fixing ternary so logic does …
TomerPacific Sep 17, 2021
7e4a398
feature/list-formatters-in-help-command creating class that will hold…
TomerPacific Sep 25, 2021
0b9e4cd
feature/list-formatters-in-help-command adding logic to extract the c…
TomerPacific Sep 25, 2021
ba24272
feature/list-formatters-in-help-command reverting changes made by add…
TomerPacific Sep 27, 2021
e322a20
feature/list-formatters-in-help-command adding documentation field to…
TomerPacific Sep 27, 2021
36f5856
feature/list-formatters-in-help-command adding documentation member t…
TomerPacific Sep 27, 2021
22d8d6d
feature/list-formatters-in-help-command removing formatterDocumentati…
TomerPacific Sep 27, 2021
fb84765
feature/list-formatters-in-help-command adding documentation field to…
TomerPacific Sep 30, 2021
1a6b554
Merge branch 'main' into feature/list-formatters-in-help-command-1700
TomerPacific Sep 30, 2021
1d7b3a5
feature/list-formatters-in-help-command fixing return type of getCons…
TomerPacific Sep 30, 2021
1fd14a1
feature/list-formatters-in-help-command removing unnecessary await
TomerPacific Oct 1, 2021
441fd56
Merge branch 'main' into feature/list-formatters-in-help-command-1700
TomerPacific Oct 1, 2021
2d2c89c
feature/list-formatters-in-help-command creating Formatters class to …
TomerPacific Oct 1, 2021
e3baeb7
Merge branch 'main' into feature/list-formatters-in-help-command-1700
TomerPacific Oct 1, 2021
fac6492
Merge branch 'main' into feature/list-formatters-in-help-command-1700
TomerPacific Oct 2, 2021
c37537c
feature/list-formatters-in-help-command adding documentation field to…
TomerPacific Oct 2, 2021
d612918
Merge branch 'feature/list-formatters-in-help-command-1700' of https:…
TomerPacific Oct 2, 2021
c600837
feature/list-formatters-in-help-command added method in formatters cl…
TomerPacific Oct 2, 2021
f898574
feature/list-formatters-in-help-command used recently added method to…
TomerPacific Oct 2, 2021
1acabd4
Merge branch 'main' into feature/list-formatters-in-help-command-1700
TomerPacific Oct 5, 2021
c42c2d2
feature/list-formatters-in-help-command adding documentation to snipp…
TomerPacific Oct 5, 2021
2bdb91a
feature/list-formatters-in-help-command adding new line to format opt…
TomerPacific Oct 5, 2021
b422359
feature/list/formatters-in-help-command converting documentation fiel…
TomerPacific Oct 5, 2021
93ae5e5
feature/list/formatters-in-help-command indenting formatters and remo…
TomerPacific Oct 5, 2021
3e9a62b
feature/list-formatters-in-help-command refactoring building the docu…
TomerPacific Oct 6, 2021
58dc26f
feature/list-formatters-in-help-command adding feature to changelog
TomerPacific Oct 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 14 additions & 23 deletions src/formatter/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,21 @@ const FormatterBuilder = {
},

getConstructorByType(type: string, cwd: string): typeof Formatter {
switch (type) {
case 'json':
return JsonFormatter
case 'message':
return MessageFormatter
case 'html':
return HtmlFormatter
case 'progress':
return ProgressFormatter
case 'progress-bar':
return ProgressBarFormatter
case 'rerun':
return RerunFormatter
case 'snippets':
return SnippetsFormatter
case 'summary':
return SummaryFormatter
case 'usage':
return UsageFormatter
case 'usage-json':
return UsageJsonFormatter
default:
return FormatterBuilder.loadCustomFormatter(type, cwd)
const formatters: Record<string, typeof Formatter> = {
json: JsonFormatter,
message: MessageFormatter,
html: HtmlFormatter,
progress: ProgressFormatter,
'progress-bar': ProgressBarFormatter,
rerun: RerunFormatter,
snippets: SnippetsFormatter,
summary: SummaryFormatter,
usage: UsageFormatter,
'usage-json': UsageJsonFormatter,
default: FormatterBuilder.loadCustomFormatter(type, cwd),
aurelien-reeves marked this conversation as resolved.
Show resolved Hide resolved
}

return formatters[type] ? formatters[type] : formatters.default
},

getStepDefinitionSnippetBuilder({
Expand Down
1 change: 1 addition & 0 deletions src/formatter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default class Formatter {
protected stream: WritableStream
protected supportCodeLibrary: ISupportCodeLibrary
private readonly cleanup: IFormatterCleanupFn
protected readonly documentation: string

constructor(options: IFormatterOptions) {
this.colorFns = options.colorFns
Expand Down