MCPcopy Create free account
hub / github.com/Koihik/LuaFormatter / main

Function main

src/main.cpp:49–546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49int main(int argc, const char* argv[]) {
50 args::ArgumentParser parser("Reformats your Lua source code.", "");
51 args::HelpFlag help(parser, "help", "Display this help menu", {'h', "help"});
52 args::Group dc(parser, "", args::Group::Validators::DontCare);
53 args::Flag verbose(dc, "verbose", "Turn on verbose mode", {'v', "verbose"});
54 args::Flag inplace(dc, "in-place", "Reformats in-place", {'i', "in-place"});
55 args::Flag check(dc, "check", "Non-zero return if formatting is needed", {"check"});
56 args::Flag dumpcfg(dc, "dump current style", "Dumps the default style used to stdout", {"dump-config"});
57 args::ValueFlag<std::string> cFile(parser, "file", "Style config file", {'c', "config"});
58 args::ValueFlag<int> columnlimit(parser, "column limit", "Column limit of one line", {"column-limit"});
59 args::ValueFlag<int> indentwidth(parser, "indentation width", "Number of spaces used for indentation",
60 {"indent-width"});
61 args::ValueFlag<int> tabwidth(parser, "tab width", "Number of spaces used per tab", {"tab-width"});
62 args::ValueFlag<int> continuationindentwidth(parser, "Continuation indentation width",
63 "Indent width for continuations line", {"continuation-indent-width"});
64 args::ValueFlag<int> spacesbeforecall(parser, "spaces before call", "Space on function calls",
65 {"spaces-before-call"});
66 args::ValueFlag<int> columntablelimit(parser, "column table limit", "Column limit of each line of a table",
67 {"column-table-limit"});
68 args::ValueFlag<char> tablesep(parser, "table separator", "Character to separate table fields", {"table-sep"});
69
70 args::Group optusetab(parser, "", args::Group::Validators::AtMostOne);
71 args::Flag usetab(optusetab, "Tab indentation", "Use tab for indentation", {"use-tab"});
72 args::Flag nousetab(optusetab, "Tab indentation", "Do not use tab for indentation", {"no-use-tab"});
73
74 args::Group optcontrolblock(parser, "", args::Group::Validators::AtMostOne);
75 args::Flag controlblock(optcontrolblock, "Control block", "keep block in one line",
76 {"keep-simple-control-block-one-line"});
77 args::Flag nocontrolblock(optcontrolblock, "Control block", "Do not keep block in one line",
78 {"no-keep-simple-control-block-one-line"});
79
80 args::Group optfunctionline(parser, "", args::Group::Validators::AtMostOne);
81 args::Flag functionline(optfunctionline, "function line", "keep function in one line",
82 {"keep-simple-function-one-line"});
83 args::Flag nofunctionline(optfunctionline, "function line", "Do not keep function in one line",
84 {"no-keep-simple-function-one-line"});
85
86 args::Group optalignargs(parser, "", args::Group::Validators::AtMostOne);
87 args::Flag alignargs(optalignargs, "align args", "Align the arguments", {"align-args"});
88 args::Flag noalignargs(optalignargs, "align args", "Do not align the arguments", {"no-align-args"});
89
90 args::Group optfunctioncallLP(parser, "", args::Group::Validators::AtMostOne);
91 args::Flag functioncallLP(optfunctioncallLP, "functioncall lp", "Break after '(' of function call",
92 {"break-after-functioncall-lp"});
93 args::Flag nofunctioncallLP(optfunctioncallLP, "functioncall lp", "Do not break after '(' of function call",
94 {"no-break-after-functioncall-lp"});
95
96 args::Group optfunctioncallRP(parser, "", args::Group::Validators::AtMostOne);
97 args::Flag functioncallRP(optfunctioncallRP, "functioncall rp", "Break before ')' of function call",
98 {"break-before-functioncall-rp"});
99 args::Flag nofunctioncallRP(optfunctioncallRP, "functioncall rp", "Do not break before ')' of function call",
100 {"no-break-before-functioncall-rp"});
101
102 args::Group optalignparameter(parser, "", args::Group::Validators::AtMostOne);
103 args::Flag alignparameter(optalignparameter, "align parameter", "Align the parameters", {"align-parameter"});
104 args::Flag noalignparameter(optalignparameter, "align parameter", "Do not align the parameters",
105 {"no-align-parameter"});
106

Callers

nothing calls this directly

Calls 7

setBinaryModeFunction · 0.85
lua_formatFunction · 0.85
file_is_usableFunction · 0.85
stringMethod · 0.80
readFromFileMethod · 0.80
readFromMapMethod · 0.80
dumpCurrentMethod · 0.80

Tested by

no test coverage detected