Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 13 additions & 7 deletions libs/libcli/src/pgmodelercliapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const QString PgModelerCliApp::CreateConfigs {"--create-configs"};
const QString PgModelerCliApp::MissingOnly {"--missing-only"};
const QString PgModelerCliApp::IgnoreFaultyPlugins {"--ignore-faulty"};
const QString PgModelerCliApp::ListPlugins {"--list-plugins"};
const QString PgModelerCliApp::NoEscapeComments {"--no-escape-comments"};

const QString PgModelerCliApp::ConnOptions {"connopts"};
const QString PgModelerCliApp::TagExpr {"<%1"};
Expand Down Expand Up @@ -155,7 +156,8 @@ std::map<QString, bool> PgModelerCliApp::long_opts {
{ CreateConfigs, false }, { Force, false }, { MissingOnly, false },
{ DependenciesSql, false }, { ChildrenSql, false }, { GenDropScript, false },
{ GroupByType, false }, { CommentsAsAliases, false }, { IgnoreFaultyPlugins, false },
{ ListPlugins, false }, { Markdown, false }, { NonTransactional, false }
{ ListPlugins, false }, { Markdown, false }, { NonTransactional, false },
{ NoEscapeComments, false }
};

attribs_map PgModelerCliApp::short_opts {
Expand Down Expand Up @@ -184,19 +186,19 @@ attribs_map PgModelerCliApp::short_opts {
{ MissingOnly, "-mo" }, { DependenciesSql, "-ds" }, { ChildrenSql, "-cs" },
{ GroupByType, "-gt" }, { GenDropScript, "-gd" }, { CommentsAsAliases, "-cl" },
{ IgnoreFaultyPlugins, "-ip" }, { ListPlugins, "-lp" }, { Markdown, "-md" },
{ NonTransactional, "-nt" }
{ NonTransactional, "-nt" }, { NoEscapeComments, "-nec" }
};

std::map<QString, QStringList> PgModelerCliApp::accepted_opts {
{{ ConnOptions }, { ConnAlias, Host, Port, User, Passwd, InitialDb }},
{{ ExportToFile }, { Input, Output, PgSqlVer, Split, DependenciesSql, ChildrenSql, GroupByType, GenDropScript }},
{{ ExportToPng }, { Input, Output, ShowGrid, ShowDelimiters, PageByPage, ZoomFactor, OverrideBgColor }},
{{ ExportToSvg }, { Input, Output, ShowGrid, ShowDelimiters }},
{{ ExportToDict }, { Input, Output, Split, NoIndex, Markdown }},
{{ ExportToFile }, { Input, Output, PgSqlVer, Split, DependenciesSql, ChildrenSql, GroupByType, GenDropScript, NoEscapeComments }},
{{ ExportToPng }, { Input, Output, ShowGrid, ShowDelimiters, PageByPage, ZoomFactor, OverrideBgColor, NoEscapeComments }},
{{ ExportToSvg }, { Input, Output, ShowGrid, ShowDelimiters, NoEscapeComments }},
{{ ExportToDict }, { Input, Output, Split, NoIndex, Markdown, NoEscapeComments }},

{{ ExportToDbms }, { Input, PgSqlVer, IgnoreDuplicates, IgnoreErrorCodes,
DropDatabase, DropObjects, Simulate, UseTmpNames, Force,
NonTransactional }},
NonTransactional, NoEscapeComments }},

{{ ImportDb }, { InputDb, Output, IgnoreImportErrors, ImportSystemObjs, ImportExtensionObjs,
FilterObjects, OnlyMatching, MatchByName, ForceChildren, DebugMode, ConnAlias,
Expand Down Expand Up @@ -520,6 +522,7 @@ void PgModelerCliApp::showMenu()
printText(tr(" %1, %2 [FILE|DIRECTORY] Output file or directory. Required for fixing models or exporting to SQL, HTML, PNG, or SVG.").arg(short_opts[Output], Output));
printText(tr(" %1, %2\t\t Force the PostgreSQL syntax to the specified version when generating SQL code. The version string must be in the form [major].[minor], e.g., %3.").arg(short_opts[PgSqlVer], PgSqlVer, PgSqlVersions::DefaulVersion));
printText(tr(" %1, %2\t\t\t Silent execution. Only critical messages and errors are displayed during the process.").arg(short_opts[Silent], Silent));
printText(tr(" %1, %2\t Disables E'' escape-string syntax on COMMENT ON statements during export. All comments are emitted as plain strings.").arg(short_opts[NoEscapeComments], NoEscapeComments));
printText();

printText(tr("SQL file export options: "));
Expand Down Expand Up @@ -770,6 +773,9 @@ void PgModelerCliApp::parseOptions(attribs_map &opts)
diff_hlp = new ModelsDiffHelper;
}

if(opts.count(NoEscapeComments))
BaseObject::setEscapeComments(false);

if(opts.empty() || opts.count(Help))
showMenu();
else
Expand Down
1 change: 1 addition & 0 deletions libs/libcli/src/pgmodelercliapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ class __libcli PgModelerCliApp: public Application {
MissingOnly,
IgnoreFaultyPlugins,
ListPlugins,
NoEscapeComments,

ConnOptions,
TagExpr,
Expand Down