Skip to content

Commit 1c7de1e

Browse files
committed
Уточнена консольная справка по режимам работы
1 parent 48b94ce commit 1c7de1e

File tree

2 files changed

+48
-26
lines changed

2 files changed

+48
-26
lines changed

src/oscript/ShowUsageBehavior.cs

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,37 @@ public override int Execute()
1414
Output.WriteLine($"1Script Execution Engine. Version {Program.GetVersion()}");
1515
Output.WriteLine();
1616
Output.WriteLine("Usage:");
17+
Output.WriteLine(" oscript.exe [options] <script_path> [script_arguments...]");
18+
Output.WriteLine(" oscript.exe <mode> [mode_options] <script_path> [script_arguments...]");
1719
Output.WriteLine();
18-
Output.WriteLine("I. Script execution: oscript.exe <script_path> [script arguments..]");
19-
Output.WriteLine();
20-
Output.WriteLine("II. Special mode: oscript.exe <mode> <script_path> [script arguments..]");
21-
Output.WriteLine("Mode can be one of these:");
22-
Output.WriteLine($" {"-measure",-12}measures execution time");
23-
Output.WriteLine($" {"-compile",-12}shows compiled module without execution");
24-
Output.WriteLine($" {"-check [-env=<entrypoint-file>]",-12}provides syntax check");
25-
Output.WriteLine($" {"-check -cgi",-12}provides syntax check in CGI-mode");
26-
Output.WriteLine($" {"-version",-12}output version string");
20+
21+
const int modeWidth = -18;
22+
const int subOptionWidth = -14;
23+
24+
Output.WriteLine("Modes:");
25+
Output.WriteLine($" {"-measure",modeWidth} Measures script execution time.");
26+
Output.WriteLine($" {"-compile",modeWidth} Shows compiled module without execution.");
27+
Output.WriteLine($" {"-check",modeWidth} Provides syntax check.");
28+
Output.WriteLine($" {"",modeWidth} Options:");
29+
Output.WriteLine($" {"",modeWidth} {"-cgi",subOptionWidth} Syntax check in CGI-mode.");
30+
Output.WriteLine($" {"",modeWidth} {"-env=<file>",subOptionWidth} Path to entrypoint file for context.");
31+
32+
Output.WriteLine($" {"-debug",modeWidth} Runs script in debug mode.");
33+
Output.WriteLine($" {"",modeWidth} Options:");
34+
Output.WriteLine($" {"",modeWidth} {"-port=<port>",subOptionWidth} Debugger port (default is 2801).");
35+
Output.WriteLine($" {"",modeWidth} {"-noWait",subOptionWidth} Do not wait for debugger connection.");
36+
37+
Output.WriteLine($" {"-version, -v",modeWidth} Output version string.");
2738
Output.WriteLine();
28-
Output.WriteLine(" -encoding=<encoding-name> set output encoding");
29-
Output.WriteLine(" -codestat=<filename> write code statistics");
39+
40+
Output.WriteLine("Options:");
41+
Output.WriteLine($" {"-encoding=<name>",modeWidth} Set output encoding (e.g. utf-8).");
42+
Output.WriteLine($" {"-codestat=<file>",modeWidth} Write code execution statistics to file.");
3043
Output.WriteLine();
31-
Output.WriteLine("III. Run as CGI application: oscript.exe -cgi <script_path> [script arguments..]");
32-
Output.WriteLine(" Runs as CGI application under HTTP-server (Apache/Nginx/IIS/etc...)");
44+
45+
Output.WriteLine("CGI Mode:");
46+
Output.WriteLine(" oscript.exe -cgi <script_path> [script_arguments...]");
47+
Output.WriteLine(" Runs as CGI application under HTTP-server.");
3348

3449
return 0;
3550
}

tests/process.os

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,22 +144,29 @@
144144
"1Script Execution Engine. Version " + СИ.Версия + "
145145
|
146146
|Usage:
147+
| oscript.exe [options] <script_path> [script_arguments...]
148+
| oscript.exe <mode> [mode_options] <script_path> [script_arguments...]
147149
|
148-
|I. Script execution: oscript.exe <script_path> [script arguments..]
150+
|Modes:
151+
| -measure Measures script execution time.
152+
| -compile Shows compiled module without execution.
153+
| -check Provides syntax check.
154+
| Options:
155+
| -cgi Syntax check in CGI-mode.
156+
| -env=<file> Path to entrypoint file for context.
157+
| -debug Runs script in debug mode.
158+
| Options:
159+
| -port=<port> Debugger port (default is 2801).
160+
| -noWait Do not wait for debugger connection.
161+
| -version, -v Output version string.
149162
|
150-
|II. Special mode: oscript.exe <mode> <script_path> [script arguments..]
151-
|Mode can be one of these:
152-
| -measure measures execution time
153-
| -compile shows compiled module without execution
154-
| -check [-env=<entrypoint-file>]provides syntax check
155-
| -check -cgi provides syntax check in CGI-mode
156-
| -version output version string
163+
|Options:
164+
| -encoding=<name> Set output encoding (e.g. utf-8).
165+
| -codestat=<file> Write code execution statistics to file.
157166
|
158-
| -encoding=<encoding-name> set output encoding
159-
| -codestat=<filename> write code statistics
160-
|
161-
|III. Run as CGI application: oscript.exe -cgi <script_path> [script arguments..]
162-
| Runs as CGI application under HTTP-server (Apache/Nginx/IIS/etc...)";
167+
|CGI Mode:
168+
| oscript.exe -cgi <script_path> [script_arguments...]
169+
| Runs as CGI application under HTTP-server.";
163170

164171
Возврат НормализоватьПереводыСтрок(Текст);
165172

0 commit comments

Comments
 (0)