MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / main

Function main

CodeFormat/src/CodeFormat.cpp:30–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28bool InitRangeFormat(CommandLine &cmd, FormatContext &formatContext);
29
30int main(int argc, char **argv) {
31 CommandLine cmd;
32 cmd.SetUsage(
33 "Usage:\n"
34 "CodeFormat [check/format/rangeformat] [options]\n"
35 "for example:\n"
36 "\tCodeFormat check -w . -d\n"
37 "\tCodeFormat format -f test.lua -d\n"
38 "\tCodeFormat check -w . -d --ignores \"Test/*.lua;src/**.lua\"\n"
39 "\tCodeFormat check -w . -d --ignores-file \".gitignore\"\n"
40 "\tCodeFormat rangeformat -i -d --rangeline 1:10\n"
41 "\tCodeFormat rangeformat -i -d --rangeOffset 0:100\n");
42 cmd.AddTarget("format")
43 .Add<std::string>("file", "f", "Specify the input file")
44 .Add<bool>("overwrite", "ow", "Format overwrite the input file")
45 .Add<std::string>("workspace", "w",
46 "Specify workspace directory,if no input file is specified, bulk formatting is performed")
47 .Add<bool>("stdin", "i", "Read from stdin")
48 .Add<std::string>("config", "c",
49 "Specify .editorconfig file, it decides on the effect of formatting")
50 .Add<bool>("detect-config", "d",
51 "Configuration will be automatically detected,\n"
52 "\t\tIf this option is set, the config option has no effect ")
53 .Add<std::string>("outfile", "o",
54 "Specify output file")
55 .Add<std::string>("ignores-file", "igf",
56 "Specify which files to ignore through configuration file,for example \".gitignore\"")
57 .Add<std::string>("ignores", "ig",
58 "Use file wildcards to specify how to ignore files\n"
59 "\t\tseparated by ';'")
60 .Add<bool>("non-standard", "", "Enable non-standard formatting")
61 .Add<bool>("c-like-comments", "", "Enable c-like-comments formatting")
62 .EnableKeyValueArgs();
63 cmd.AddTarget("rangeformat")
64 .Add<std::string>("file", "f", "Specify the input file")
65 .Add<std::string>("workspace", "w",
66 "Specify workspace directory, It can be used to automatically check the configuration")
67 .Add<bool>("stdin", "i", "Read from stdin")
68 .Add<std::string>("config", "c",
69 "Specify .editorconfig file, it decides on the effect of formatting")
70 .Add<bool>("detect-config", "d",
71 "Configuration will be automatically detected,\n"
72 "\t\tIf this option is set, the config option has no effect ")
73 .Add<bool>("complete-output", "",
74 "If true, all content will be output")
75 .Add<std::string>("range-line", "", "the format is startline:endline, for eg: 1:10")
76 .Add<std::string>("range-offset", "", "the format is startOffset:endOffset, for eg: 0:256")
77 .Add<bool>("non-standard", "", "Enable non-standard rangeformatting")
78 .Add<bool>("c-like-comments", "", "Enable c-like-comments formatting")
79 .EnableKeyValueArgs();
80 cmd.AddTarget("check")
81 .Add<std::string>("file", "f", "Specify the input file")
82 .Add<bool>("stdin", "i", "Read from stdin")
83 .Add<std::string>("workspace", "w",
84 "Specify workspace directory, if no input file is specified, bulk checking is performed")
85 .Add<std::string>("config", "c",
86 "Specify editorconfig file, it decides on the effect of formatting or diagnosis")
87 .Add<bool>("detect-config", "d",

Callers

nothing calls this directly

Calls 10

InitFormatFunction · 0.85
InitCheckFunction · 0.85
InitRangeFormatFunction · 0.85
SetUsageMethod · 0.80
PrintUsageMethod · 0.80
GetTargetMethod · 0.80
RangeReformatMethod · 0.80
ParseMethod · 0.45
ReformatMethod · 0.45
CheckMethod · 0.45

Tested by

no test coverage detected