MCPcopy Create free account
hub / github.com/microsoft/typescript-go / printEasyHelp

Function printEasyHelp

internal/execute/tsc/help.go:67–108  ·  view source on GitHub ↗
(sys System, locale locale.Locale, simpleOptions []*tsoptions.CommandLineOption)

Source from the content-addressed store, hash-verified

65}
66
67func printEasyHelp(sys System, locale locale.Locale, simpleOptions []*tsoptions.CommandLineOption) {
68 colors := createColors(sys)
69 var output []string
70 example := func(examples []string, desc *diagnostics.Message) {
71 for _, example := range examples {
72 output = append(output, " ", colors.blue(example), "\n")
73 }
74 output = append(output, " ", desc.Localize(locale), "\n", "\n")
75 }
76
77 msg := diagnostics.X_tsc_Colon_The_TypeScript_Compiler.Localize(locale) + " - " + diagnostics.Version_0.Localize(locale, core.Version())
78 output = append(output, getHeader(sys, msg)...)
79
80 output = append(output, colors.bold(diagnostics.COMMON_COMMANDS.Localize(locale)), "\n", "\n")
81
82 example([]string{"tsc"}, diagnostics.Compiles_the_current_project_tsconfig_json_in_the_working_directory)
83 example([]string{"tsc app.ts util.ts"}, diagnostics.Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options)
84 example([]string{"tsc -b"}, diagnostics.Build_a_composite_project_in_the_working_directory)
85 example([]string{"tsc --init"}, diagnostics.Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory)
86 example([]string{"tsc -p ./path/to/tsconfig.json"}, diagnostics.Compiles_the_TypeScript_project_located_at_the_specified_path)
87 example([]string{"tsc --help --all"}, diagnostics.An_expanded_version_of_this_information_showing_all_possible_compiler_options)
88 example([]string{"tsc --noEmit", "tsc --target esnext"}, diagnostics.Compiles_the_current_project_with_additional_settings)
89
90 var cliCommands []*tsoptions.CommandLineOption
91 var configOpts []*tsoptions.CommandLineOption
92 for _, opt := range simpleOptions {
93 if opt.IsCommandLineOnly || opt.Category == diagnostics.Command_line_Options {
94 cliCommands = append(cliCommands, opt)
95 } else {
96 configOpts = append(configOpts, opt)
97 }
98 }
99
100 output = append(output, generateSectionOptionsOutput(sys, locale, diagnostics.COMMAND_LINE_FLAGS.Localize(locale), cliCommands /*subCategory*/, false /*beforeOptionsDescription*/, nil /*afterOptionsDescription*/, nil)...)
101
102 after := diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0.Localize(locale, "https://aka.ms/tsc")
103 output = append(output, generateSectionOptionsOutput(sys, locale, diagnostics.COMMON_COMPILER_OPTIONS.Localize(locale), configOpts /*subCategory*/, false /*beforeOptionsDescription*/, nil, &after)...)
104
105 for _, chunk := range output {
106 fmt.Fprint(sys.Writer(), chunk)
107 }
108}
109
110func printAllHelp(sys System, locale locale.Locale, options []*tsoptions.CommandLineOption) {
111 var output []string

Callers 1

PrintHelpFunction · 0.85

Calls 10

VersionFunction · 0.92
createColorsFunction · 0.85
getHeaderFunction · 0.85
blueMethod · 0.80
LocalizeMethod · 0.65
boldMethod · 0.65
WriterMethod · 0.65
appendFunction · 0.50
exampleFunction · 0.50

Tested by

no test coverage detected