-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
List formatters in help command (#1798)
* feature/list-formatters-in-help-command adding documentation field to Formatter class * feature/list-formatters-in-help-command refactoring getConstructorByType method to hold a Record<string, typeof Formatter> * feature/list-formatters-in-help-command improving return statement to deal with cases where the default formatter should be returned * feature/list-formatters-in-help-command after running lint fix * feature/list-formatters-in-help-command fixing ternary so logic does not invoke load customFormatter * feature/list-formatters-in-help-command creating class that will hold the description of the formatters * feature/list-formatters-in-help-command adding logic to extract the correct documentation for each formatter and altering the IFormatter type to have this field * feature/list-formatters-in-help-command reverting changes made by adding the documentation field to the formatter object * feature/list-formatters-in-help-command adding documentation field to html formatter * feature/list-formatters-in-help-command adding documentation member to json/message/progress/rerun/summary/usage formatters * feature/list-formatters-in-help-command removing formatterDocumentationHelper class as it is no longer needed * feature/list-formatters-in-help-command adding documentation field to rerun formatter * feature/list-formatters-in-help-command fixing return type of getConstructorByType method and running linter * feature/list-formatters-in-help-command removing unnecessary await * feature/list-formatters-in-help-command creating Formatters class to hold different formatters and extracting them from the builder class * feature/list-formatters-in-help-command adding documentation field to progress-bar/snippets/usage-json formatters * feature/list-formatters-in-help-command added method in formatters class to help build the documentation string * feature/list-formatters-in-help-command used recently added method to list all available formatters * feature/list-formatters-in-help-command adding documentation to snippets/progress-bar/usage-json formatters * feature/list-formatters-in-help-command adding new line to format option so that formatters will appear on new line * feature/list/formatters-in-help-command converting documentation field inside formatter to be public and static. Refactoring buildFormatterDocumentationString * feature/list/formatters-in-help-command indenting formatters and removing extra space * feature/list-formatters-in-help-command refactoring building the documentation string * feature/list-formatters-in-help-command adding feature to changelog
- Loading branch information
1 parent
0aeb59c
commit a17accb
Showing
15 changed files
with
76 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import Formatter from '../.' | ||
import JsonFormatter from '../json_formatter' | ||
import MessageFormatter from '../message_formatter' | ||
import ProgressBarFormatter from '../progress_bar_formatter' | ||
import ProgressFormatter from '../progress_formatter' | ||
import RerunFormatter from '../rerun_formatter' | ||
import SnippetsFormatter from '../snippets_formatter' | ||
import SummaryFormatter from '../summary_formatter' | ||
import UsageFormatter from '../usage_formatter' | ||
import UsageJsonFormatter from '../usage_json_formatter' | ||
import HtmlFormatter from '../html_formatter' | ||
|
||
const Formatters = { | ||
getFormatters(): Record<string, typeof Formatter> { | ||
return { | ||
json: JsonFormatter, | ||
message: MessageFormatter, | ||
html: HtmlFormatter, | ||
progress: ProgressFormatter, | ||
'progress-bar': ProgressBarFormatter, | ||
rerun: RerunFormatter, | ||
snippets: SnippetsFormatter, | ||
summary: SummaryFormatter, | ||
usage: UsageFormatter, | ||
'usage-json': UsageJsonFormatter, | ||
} | ||
}, | ||
buildFormattersDocumentationString(): string { | ||
let concatanatedFormattersDocumentation: string = '' | ||
const formatters = this.getFormatters() | ||
for (const formatterName in formatters) { | ||
concatanatedFormattersDocumentation += ` ${formatterName}: ${formatters[formatterName].documentation}\n` | ||
} | ||
|
||
return concatanatedFormattersDocumentation | ||
}, | ||
} | ||
|
||
export default Formatters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters