From 1dee6ad6077f3f3d3574c54ca2fce9c73d6d046d Mon Sep 17 00:00:00 2001 From: "Zamrony P. Juhara" Date: Fri, 9 Apr 2021 19:59:44 +0700 Subject: [PATCH] implement file string to pascal string variable --- .../Text2Inc/Text2IncTaskImpl.pas | 180 ++++++++++++++++++ .../Controller/task.registrations.inc | 4 +- .../Deploy/Cgi/task.registrations.inc | 6 +- .../Deploy/Fcgi/task.registrations.inc | 10 +- .../FcgiBalancer/task.registrations.inc | 14 +- .../Deploy/Fcgid/task.registrations.inc | 4 +- .../Deploy/Http/task.registrations.inc | 10 +- .../HttpBalancer/task.registrations.inc | 14 +- .../Deploy/Scgi/task.registrations.inc | 10 +- .../ScgiBalancer/task.registrations.inc | 14 +- .../Deploy/Uwsgi/task.registrations.inc | 10 +- .../UwsgiBalancer/task.registrations.inc | 14 +- .../Minifier/Css/task.registrations.inc | 2 +- .../Minifier/Js/task.registrations.inc | 2 +- .../Project/FastCgi/task.registrations.inc | 2 +- .../Project/Scgi/task.registrations.inc | 6 +- .../Project/Uwsgi/task.registrations.inc | 6 +- .../Includes/Text2Inc/task.registrations.inc | 20 ++ src/Tasks/Includes/task.registrations.inc | 1 + src/Tasks/Includes/units.inc | 1 + unit.search.cfg | 2 + 21 files changed, 268 insertions(+), 64 deletions(-) create mode 100644 src/Tasks/Implementations/Text2Inc/Text2IncTaskImpl.pas create mode 100644 src/Tasks/Includes/Text2Inc/task.registrations.inc diff --git a/src/Tasks/Implementations/Text2Inc/Text2IncTaskImpl.pas b/src/Tasks/Implementations/Text2Inc/Text2IncTaskImpl.pas new file mode 100644 index 0000000..323c93e --- /dev/null +++ b/src/Tasks/Implementations/Text2Inc/Text2IncTaskImpl.pas @@ -0,0 +1,180 @@ +(*!------------------------------------------------------------ + * Fano CLI Application (https://fanoframework.github.io) + * + * @link https://github.com/fanoframework/fano-cli + * @copyright Copyright (c) 2018 - 2020 Zamrony P. Juhara + * @license https://github.com/fanoframework/fano-cli/blob/master/LICENSE (MIT) + *------------------------------------------------------------- *) +unit Text2IncTaskImpl; + +interface + +{$MODE OBJFPC} +{$H+} + +uses + + TaskOptionsIntf, + TaskIntf, + Classes, + SysUtils; + +type + + (*!-------------------------------------- + * Task that convert file string into + * pascal string variable + *--------------------------------------------- + * If we have file with content as follows + * hello world + * It will create new file with content as follows + * varName : string = + * 'hello world'; + *--------------------------------------------- + * @credit https://github.com/zamronypj/txt2inc + * @author Zamrony P. Juhara + *---------------------------------------*) + TText2IncTask = class(TInterfacedObject, ITask) + private + function readStdIn() : string; + procedure txt2inc( + const src : TStrings; + const dst : TStrings; + const varName : string + ); + public + function run( + const opt : ITaskOptions; + const longOpt : shortstring + ) : ITask; + end; + +implementation + +uses + + iostream, + StrFormats; + + function TText2IncTask.readStdIn() : string; + var + buffer: string; + Count: Integer; + MyStream: TStringStream; + InputStream: TIOStream; + begin + MyStream := TStringStream.Create; + try + InputStream := TIOStream.Create(iosInput); + try + setLength(buffer, 4 * 1024); + repeat + Count := InputStream.read(buffer[1], Length(buffer)); + if Count > 0 then + begin + MyStream.write(buffer[1], count); + end; + until Count = 0; + result := MyStream.dataString; + finally + InputStream.Free; + end; + finally + MyStream.Free; + end; + end; + + procedure TText2IncTask.txt2inc( + const src : TStrings; + const dst : TStrings; + const varName : string + ); + var i : integer; + begin + dst.add(varName + ' : string = '); + + for i:=0 to src.count-2 do + begin + dst.add(' ' + QuotedStr(src[i]) + ' + LineEnding + '); + end; + + if (src.count > 0) then + begin + dst.add(' ' + QuotedStr(src[src.count-1]) + ';'); + end; + end; + + function TText2IncTask.run( + const opt : ITaskOptions; + const longOpt : shortstring + ) : ITask; + var srcFile : string; + dstFile : string; + varName : string; + src : TStrings; + dst : TStrings; + begin + result := self; + src:= TStringList.Create(); + try + dst:= TStringList.Create(); + try + srcFile := opt.getOptionValue('src'); + if (srcFile = '') or (not opt.hasOption('src')) then + begin + src.text := readStdIn(); + end else + begin + if not FileExists(srcFile) then + begin + writeln('Error. File ' + formatColor(srcFile, TXT_RED) + ' does not exist.'); + exit; + end; + src.loadFromFile(srcFile); + end; + + + dstFile := opt.getOptionValue('dst'); + if (dstFile = '') and (srcFile <> '') then + begin + dstFile := srcFile + '.inc'; + end; + + if (dstFile <> '') and (FileExists(dstFile)) and (not opt.hasOption('force')) then + begin + writeln( + 'Error. File ' + + formatColor(dstFile, TXT_RED) + + ' exists. Add ' + + formatColor('--force', TXT_GREEN) + + ' to overwrite it.' + ); + exit; + end; + + varName := opt.getOptionValueDef('var', 'myStr'); + + + txt2inc(src, dst, varName); + + if (dstFile = '') then + begin + writeln(); + writeln('{-------------begin----------------}'); + write(dst.text); + writeln('{-------------end------------------}'); + writeln(); + end else + begin + dst.saveToFile(dstFile); + writeln('OK. ' + formatColor(dstFile, TXT_GREEN) + ' created'); + end; + + finally + dst.free(); + end; + finally + src.free(); + end; + end; +end. diff --git a/src/Tasks/Includes/Controller/task.registrations.inc b/src/Tasks/Includes/Controller/task.registrations.inc index 5a1d27c..a5c9158 100644 --- a/src/Tasks/Includes/Controller/task.registrations.inc +++ b/src/Tasks/Includes/Controller/task.registrations.inc @@ -13,8 +13,8 @@ try appInst.registerTask( 'controller', '--controller=[controller-name] Create new controller' + LineEnding + - ' --route=[route pattern] if omited, controller name is assumed.' + LineEnding + - ' --method=[request method] if omited, HTTP GET is assumed.', + ' --route=[route pattern] if omitted, controller name is assumed.' + LineEnding + + ' --method=[request method] if omitted, HTTP GET is assumed.', taskFactory.build() ); finally diff --git a/src/Tasks/Includes/Deploy/Cgi/task.registrations.inc b/src/Tasks/Includes/Deploy/Cgi/task.registrations.inc index da8d809..862462b 100644 --- a/src/Tasks/Includes/Deploy/Cgi/task.registrations.inc +++ b/src/Tasks/Includes/Deploy/Cgi/task.registrations.inc @@ -13,9 +13,9 @@ try appInst.registerTask( 'deploy-cgi', '--deploy-cgi=[server name] Deploy as CGI web application.' + LineEnding + - ' --web-server=[web server] if omited, apache is assumed.' + LineEnding + - ' --doc-root=[document-root] if omited, public directory in current directory is used.' + LineEnding + - ' --server-ip=[web server ip] if omited, 127.0.0.1 is assumed.', + ' --web-server=[web server] if omitted, apache is assumed.' + LineEnding + + ' --doc-root=[document-root] if omitted, public directory in current directory is used.' + LineEnding + + ' --server-ip=[web server ip] if omitted, 127.0.0.1 is assumed.', taskFactory.build() ); finally diff --git a/src/Tasks/Includes/Deploy/Fcgi/task.registrations.inc b/src/Tasks/Includes/Deploy/Fcgi/task.registrations.inc index d2cda4d..c815d2d 100644 --- a/src/Tasks/Includes/Deploy/Fcgi/task.registrations.inc +++ b/src/Tasks/Includes/Deploy/Fcgi/task.registrations.inc @@ -13,11 +13,11 @@ try appInst.registerTask( 'deploy-fcgi', '--deploy-fcgi=[server name] Deploy as FastCGI web application with mod_proxy_fcgi.' + LineEnding + - ' --web-server=[web server] if omited, apache is assumed.' + LineEnding + - ' --doc-root=[document-root] if omited, public directory in current directory is used.' + LineEnding + - ' --server-ip=[web server ip] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --host=[host where FastCGI app listen] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --port=[port where FastCGI app listen] if omited, 20477 is assumed.', + ' --web-server=[web server] if omitted, apache is assumed.' + LineEnding + + ' --doc-root=[document-root] if omitted, public directory in current directory is used.' + LineEnding + + ' --server-ip=[web server ip] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --host=[host where FastCGI app listen] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --port=[port where FastCGI app listen] if omitted, 20477 is assumed.', taskFactory.build() ); finally diff --git a/src/Tasks/Includes/Deploy/FcgiBalancer/task.registrations.inc b/src/Tasks/Includes/Deploy/FcgiBalancer/task.registrations.inc index 528885b..197da8e 100644 --- a/src/Tasks/Includes/Deploy/FcgiBalancer/task.registrations.inc +++ b/src/Tasks/Includes/Deploy/FcgiBalancer/task.registrations.inc @@ -13,13 +13,13 @@ try appInst.registerTask( 'deploy-lb-fcgi', '--deploy-lb-fcgi=[server name] Deploy as FastCGI web application with mod_proxy_balancer.' + LineEnding + - ' --members=[host1:port1,host2:port2,...], if omited, 2 default members is assumed.' + LineEnding + - ' --lbmethod=[load balancing scheduler algorithm] if omited, byrequests is assumed.' + LineEnding + - ' --web-server=[web server] if omited, apache is assumed.' + LineEnding + - ' --doc-root=[document-root] if omited, public directory in current directory is used.' + LineEnding + - ' --server-ip=[web server ip] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --host=[host where FastCGI app listen] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --port=[port where FastCGI app listen] if omited, 20477 is assumed.', + ' --members=[host1:port1,host2:port2,...], if omitted, 2 default members is assumed.' + LineEnding + + ' --lbmethod=[load balancing scheduler algorithm] if omitted, byrequests is assumed.' + LineEnding + + ' --web-server=[web server] if omitted, apache is assumed.' + LineEnding + + ' --doc-root=[document-root] if omitted, public directory in current directory is used.' + LineEnding + + ' --server-ip=[web server ip] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --host=[host where FastCGI app listen] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --port=[port where FastCGI app listen] if omitted, 20477 is assumed.', taskFactory.build() ); finally diff --git a/src/Tasks/Includes/Deploy/Fcgid/task.registrations.inc b/src/Tasks/Includes/Deploy/Fcgid/task.registrations.inc index a571c51..d8b5583 100644 --- a/src/Tasks/Includes/Deploy/Fcgid/task.registrations.inc +++ b/src/Tasks/Includes/Deploy/Fcgid/task.registrations.inc @@ -13,8 +13,8 @@ try appInst.registerTask( 'deploy-fcgid', '--deploy-fcgid=[server name] Deploy as FastCGI web application with mod_fcgid.' + LineEnding + - ' --doc-root=[document-root] if omited, public directory in current directory is used.' + LineEnding + - ' --server-ip=[web server ip] if omited, 127.0.0.1 is assumed.', + ' --doc-root=[document-root] if omitted, public directory in current directory is used.' + LineEnding + + ' --server-ip=[web server ip] if omitted, 127.0.0.1 is assumed.', taskFactory.build() ); finally diff --git a/src/Tasks/Includes/Deploy/Http/task.registrations.inc b/src/Tasks/Includes/Deploy/Http/task.registrations.inc index ff319dd..14bd6e0 100644 --- a/src/Tasks/Includes/Deploy/Http/task.registrations.inc +++ b/src/Tasks/Includes/Deploy/Http/task.registrations.inc @@ -13,11 +13,11 @@ try appInst.registerTask( 'deploy-http', '--deploy-http=[server name] Deploy as http web application over http reverse proxy server.' + LineEnding + - ' --web-server=[web server] if omited, apache is assumed.' + LineEnding + - ' --doc-root=[document-root] if omited, public directory in current directory is used.' + LineEnding + - ' --server-ip=[web server ip] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --host=[host where http app listen] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --port=[port where http app listen] if omited, 20477 is assumed.', + ' --web-server=[web server] if omitted, apache is assumed.' + LineEnding + + ' --doc-root=[document-root] if omitted, public directory in current directory is used.' + LineEnding + + ' --server-ip=[web server ip] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --host=[host where http app listen] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --port=[port where http app listen] if omitted, 20477 is assumed.', taskFactory.build() ); finally diff --git a/src/Tasks/Includes/Deploy/HttpBalancer/task.registrations.inc b/src/Tasks/Includes/Deploy/HttpBalancer/task.registrations.inc index 78b09bd..83edaeb 100644 --- a/src/Tasks/Includes/Deploy/HttpBalancer/task.registrations.inc +++ b/src/Tasks/Includes/Deploy/HttpBalancer/task.registrations.inc @@ -13,13 +13,13 @@ try appInst.registerTask( 'deploy-lb-http', '--deploy-lb-http=[server name] Deploy as http web application with mod_proxy_balancer.' + LineEnding + - ' --members=[host1:port1,host2:port2,...], if omited, 2 default members is assumed.' + LineEnding + - ' --lbmethod=[load balancing scheduler algorithm] if omited, byrequests is assumed.' + LineEnding + - ' --web-server=[web server] if omited, apache is assumed.' + LineEnding + - ' --doc-root=[document-root] if omited, public directory in current directory is used.' + LineEnding + - ' --server-ip=[web server ip] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --host=[host where http app listen] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --port=[port where http app listen] if omited, 20477 is assumed.', + ' --members=[host1:port1,host2:port2,...], if omitted, 2 default members is assumed.' + LineEnding + + ' --lbmethod=[load balancing scheduler algorithm] if omitted, byrequests is assumed.' + LineEnding + + ' --web-server=[web server] if omitted, apache is assumed.' + LineEnding + + ' --doc-root=[document-root] if omitted, public directory in current directory is used.' + LineEnding + + ' --server-ip=[web server ip] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --host=[host where http app listen] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --port=[port where http app listen] if omitted, 20477 is assumed.', taskFactory.build() ); finally diff --git a/src/Tasks/Includes/Deploy/Scgi/task.registrations.inc b/src/Tasks/Includes/Deploy/Scgi/task.registrations.inc index 1f77afd..a42c262 100644 --- a/src/Tasks/Includes/Deploy/Scgi/task.registrations.inc +++ b/src/Tasks/Includes/Deploy/Scgi/task.registrations.inc @@ -13,11 +13,11 @@ try appInst.registerTask( 'deploy-scgi', '--deploy-scgi=[server name] Deploy as SCGI web application.' + LineEnding + - ' --web-server=[web server] if omited, apache is assumed.' + LineEnding + - ' --doc-root=[document-root] if omited, public directory in current directory is used.' + LineEnding + - ' --server-ip=[web server ip] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --host=[host where SCGI app listen] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --port=[port where SCGI app listen] if omited, 20477 is assumed.', + ' --web-server=[web server] if omitted, apache is assumed.' + LineEnding + + ' --doc-root=[document-root] if omitted, public directory in current directory is used.' + LineEnding + + ' --server-ip=[web server ip] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --host=[host where SCGI app listen] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --port=[port where SCGI app listen] if omitted, 20477 is assumed.', taskFactory.build() ); finally diff --git a/src/Tasks/Includes/Deploy/ScgiBalancer/task.registrations.inc b/src/Tasks/Includes/Deploy/ScgiBalancer/task.registrations.inc index 0325e57..5149d0e 100644 --- a/src/Tasks/Includes/Deploy/ScgiBalancer/task.registrations.inc +++ b/src/Tasks/Includes/Deploy/ScgiBalancer/task.registrations.inc @@ -13,13 +13,13 @@ try appInst.registerTask( 'deploy-lb-scgi', '--deploy-lb-scgi=[server name] Deploy as SCGI web application with mod_proxy_balancer.' + LineEnding + - ' --members=[host1:port1,host2:port2,...], if omited, 2 default members is assumed.' + LineEnding + - ' --lbmethod=[load balancing scheduler algorithm] if omited, byrequests is assumed.' + LineEnding + - ' --web-server=[web server] if omited, apache is assumed.' + LineEnding + - ' --doc-root=[document-root] if omited, public directory in current directory is used.' + LineEnding + - ' --server-ip=[web server ip] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --host=[host where SCGI app listen] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --port=[port where SCGI app listen] if omited, 20477 is assumed.', + ' --members=[host1:port1,host2:port2,...], if omitted, 2 default members is assumed.' + LineEnding + + ' --lbmethod=[load balancing scheduler algorithm] if omitted, byrequests is assumed.' + LineEnding + + ' --web-server=[web server] if omitted, apache is assumed.' + LineEnding + + ' --doc-root=[document-root] if omitted, public directory in current directory is used.' + LineEnding + + ' --server-ip=[web server ip] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --host=[host where SCGI app listen] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --port=[port where SCGI app listen] if omitted, 20477 is assumed.', taskFactory.build() ); finally diff --git a/src/Tasks/Includes/Deploy/Uwsgi/task.registrations.inc b/src/Tasks/Includes/Deploy/Uwsgi/task.registrations.inc index 24a70cf..6614590 100644 --- a/src/Tasks/Includes/Deploy/Uwsgi/task.registrations.inc +++ b/src/Tasks/Includes/Deploy/Uwsgi/task.registrations.inc @@ -13,11 +13,11 @@ try appInst.registerTask( 'deploy-uwsgi', '--deploy-uwsgi=[server name] Deploy as uwsgi web application.' + LineEnding + - ' --web-server=[web server] if omited, apache is assumed.' + LineEnding + - ' --doc-root=[document-root] if omited, public directory in current directory is used.' + LineEnding + - ' --server-ip=[web server ip] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --host=[host where uwsgi app listen] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --port=[port where uwsgi app listen] if omited, 20477 is assumed.', + ' --web-server=[web server] if omitted, apache is assumed.' + LineEnding + + ' --doc-root=[document-root] if omitted, public directory in current directory is used.' + LineEnding + + ' --server-ip=[web server ip] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --host=[host where uwsgi app listen] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --port=[port where uwsgi app listen] if omitted, 20477 is assumed.', taskFactory.build() ); finally diff --git a/src/Tasks/Includes/Deploy/UwsgiBalancer/task.registrations.inc b/src/Tasks/Includes/Deploy/UwsgiBalancer/task.registrations.inc index bca92d7..2fdd000 100644 --- a/src/Tasks/Includes/Deploy/UwsgiBalancer/task.registrations.inc +++ b/src/Tasks/Includes/Deploy/UwsgiBalancer/task.registrations.inc @@ -13,13 +13,13 @@ try appInst.registerTask( 'deploy-lb-uwsgi', '--deploy-lb-uwsgi=[server name] Deploy as uwsgi web application with mod_proxy_balancer.' + LineEnding + - ' --members=[host1:port1,host2:port2,...], if omited, 2 default members is assumed.' + LineEnding + - ' --lbmethod=[load balancing scheduler algorithm] if omited, byrequests is assumed.' + LineEnding + - ' --web-server=[web server] if omited, apache is assumed.' + LineEnding + - ' --doc-root=[document-root] if omited, public directory in current directory is used.' + LineEnding + - ' --server-ip=[web server ip] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --host=[host where uwsgi app listen] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --port=[port where uwsgi app listen] if omited, 20477 is assumed.', + ' --members=[host1:port1,host2:port2,...], if omitted, 2 default members is assumed.' + LineEnding + + ' --lbmethod=[load balancing scheduler algorithm] if omitted, byrequests is assumed.' + LineEnding + + ' --web-server=[web server] if omitted, apache is assumed.' + LineEnding + + ' --doc-root=[document-root] if omitted, public directory in current directory is used.' + LineEnding + + ' --server-ip=[web server ip] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --host=[host where uwsgi app listen] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --port=[port where uwsgi app listen] if omitted, 20477 is assumed.', taskFactory.build() ); finally diff --git a/src/Tasks/Includes/Minifier/Css/task.registrations.inc b/src/Tasks/Includes/Minifier/Css/task.registrations.inc index 04921af..a3ce9f6 100644 --- a/src/Tasks/Includes/Minifier/Css/task.registrations.inc +++ b/src/Tasks/Includes/Minifier/Css/task.registrations.inc @@ -14,7 +14,7 @@ try 'cssmin', '--cssmin=[path] Minify CSS file. Path can be file path or directory.' + LineEnding + ' --output=[output path] target output path' + LineEnding + - ' if omited, it is assumed [path].min.css' + LineEnding + + ' if omitted, it is assumed [path].min.css' + LineEnding + ' if output-path = stdout, minified version is output to STDOUT', taskFactory.build() ); diff --git a/src/Tasks/Includes/Minifier/Js/task.registrations.inc b/src/Tasks/Includes/Minifier/Js/task.registrations.inc index abe21c3..880bd1f 100644 --- a/src/Tasks/Includes/Minifier/Js/task.registrations.inc +++ b/src/Tasks/Includes/Minifier/Js/task.registrations.inc @@ -14,7 +14,7 @@ try 'jsmin', '--jsmin=[path] Minify JavaScript file. Path can be file path or directory.' + LineEnding + ' --output=[output path] target output path' + LineEnding + - ' if omited, it is assumed [path].min.js' + LineEnding + + ' if omitted, it is assumed [path].min.js' + LineEnding + ' if output-path = stdout, minified version is output to STDOUT', taskFactory.build() ); diff --git a/src/Tasks/Includes/Project/FastCgi/task.registrations.inc b/src/Tasks/Includes/Project/FastCgi/task.registrations.inc index ab821be..98963e6 100644 --- a/src/Tasks/Includes/Project/FastCgi/task.registrations.inc +++ b/src/Tasks/Includes/Project/FastCgi/task.registrations.inc @@ -16,7 +16,7 @@ try appInst.registerTask( 'project-fcgi', '--project-fcgi=[project-name] Create new FastCGI project.' + LineEnding + - ' --config=[ini, json] if omited, config is not setup.' + LineEnding + + ' --config=[ini, json] if omitted, config is not setup.' + LineEnding + ' --host=[host where FastCGI app listen] if omitted, 127.0.0.1 is assumed.' + LineEnding + ' --port=[port where FastCGI app listen] if omitted, 20477 is assumed.' + LineEnding + ' --with-session=[file, cookie, db] Add session support' + LineEnding + diff --git a/src/Tasks/Includes/Project/Scgi/task.registrations.inc b/src/Tasks/Includes/Project/Scgi/task.registrations.inc index a092d2b..927a371 100644 --- a/src/Tasks/Includes/Project/Scgi/task.registrations.inc +++ b/src/Tasks/Includes/Project/Scgi/task.registrations.inc @@ -16,9 +16,9 @@ try appInst.registerTask( 'project-scgi', '--project-scgi=[project-name] Create new SCGI project' + LineEnding + - ' --config=[ini, json] if omited, config is not setup.' + LineEnding + - ' --host=[host where SCGI app listen] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --port=[port where SCGI app listen] if omited, 20477 is assumed.' + LineEnding + + ' --config=[ini, json] if omitted, config is not setup.' + LineEnding + + ' --host=[host where SCGI app listen] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --port=[port where SCGI app listen] if omitted, 20477 is assumed.' + LineEnding + ' --with-session=[file, cookie, db] Add session support' + LineEnding + ' --with-middleware Add middleware support' + LineEnding + ' --with-csrf Add CSRF support' + LineEnding + diff --git a/src/Tasks/Includes/Project/Uwsgi/task.registrations.inc b/src/Tasks/Includes/Project/Uwsgi/task.registrations.inc index 5d2a2db..d651534 100644 --- a/src/Tasks/Includes/Project/Uwsgi/task.registrations.inc +++ b/src/Tasks/Includes/Project/Uwsgi/task.registrations.inc @@ -16,9 +16,9 @@ try appInst.registerTask( 'project-uwsgi', '--project-uwsgi=[project-name] Create new uwsgi project' + LineEnding + - ' --config=[ini, json] if omited, config is not setup.' + LineEnding + - ' --host=[host where uwsgi app listen] if omited, 127.0.0.1 is assumed.' + LineEnding + - ' --port=[port where uwsgi app listen] if omited, 20477 is assumed.' + LineEnding + + ' --config=[ini, json] if omitted, config is not setup.' + LineEnding + + ' --host=[host where uwsgi app listen] if omitted, 127.0.0.1 is assumed.' + LineEnding + + ' --port=[port where uwsgi app listen] if omitted, 20477 is assumed.' + LineEnding + ' --with-session=[file, cookie, db] Add session support' + LineEnding + ' --with-middleware Add middleware support' + LineEnding + ' --with-csrf Add CSRF support' + LineEnding + diff --git a/src/Tasks/Includes/Text2Inc/task.registrations.inc b/src/Tasks/Includes/Text2Inc/task.registrations.inc new file mode 100644 index 0000000..98c3e63 --- /dev/null +++ b/src/Tasks/Includes/Text2Inc/task.registrations.inc @@ -0,0 +1,20 @@ +(*!------------------------------------------------------------ + * Fano CLI Application (https://fanoframework.github.io) + * + * @link https://github.com/fanoframework/fano-cli + * @copyright Copyright (c) 2018 - 2020 Zamrony P. Juhara + * @license https://github.com/fanoframework/fano-cli/blob/master/LICENSE (MIT) + *------------------------------------------------------------- *) + +{%../Includes/task.registrations.inc} + +appInst.registerTask( + 'txt2inc', + '--txt2inc Generate Pascal string variable declaration from file string.' + LineEnding + + ' --src=[source file path] if omitted, STDIN is used.' + LineEnding + + ' --dst=[destination file path]' + LineEnding + + ' if omitted and --src is set, use --src file path concatenated with inc extension' + LineEnding + + ' if omitted and --src is not set, output to STDOUT.' + LineEnding + + ' --var=[name of variable] if omitted, "myStr" is used.' + LineEnding, + TText2IncTask.create() +); diff --git a/src/Tasks/Includes/task.registrations.inc b/src/Tasks/Includes/task.registrations.inc index 5f0d7fd..9362c14 100644 --- a/src/Tasks/Includes/task.registrations.inc +++ b/src/Tasks/Includes/task.registrations.inc @@ -20,3 +20,4 @@ {$INCLUDE Deploy/task.registrations.inc} {$INCLUDE Minifier/task.registrations.inc} {$INCLUDE Daemon/task.registrations.inc} +{$INCLUDE Text2Inc/task.registrations.inc} diff --git a/src/Tasks/Includes/units.inc b/src/Tasks/Includes/units.inc index e4030cd..e4d27c7 100644 --- a/src/Tasks/Includes/units.inc +++ b/src/Tasks/Includes/units.inc @@ -12,6 +12,7 @@ InfoTaskImpl, KeyGenTaskImpl, KeyGenTaskFactoryImpl, GuidGenTaskImpl, +Text2IncTaskImpl, {$INCLUDE Project/units.inc} diff --git a/unit.search.cfg b/unit.search.cfg index 097b6e6..8cab797 100644 --- a/unit.search.cfg +++ b/unit.search.cfg @@ -39,6 +39,8 @@ -Fusrc/Tasks/Implementations/KeyGen/Factories -Fusrc/Tasks/Implementations/GuidGen -Fusrc/Tasks/Implementations/GuidGen/Factories +-Fusrc/Tasks/Implementations/Text2Inc +-Fusrc/Tasks/Implementations/Text2Inc/Factories -Fusrc/Tasks/Implementations/Project -Fusrc/Tasks/Implementations/Project -Fusrc/Tasks/Implementations/Project/Core