Skip to content

Commit

Permalink
refact CommandLine code
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey-T committed Mar 26, 2017
1 parent 852f85d commit dcd6c0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/formmain_commandline.inc
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,15 @@ begin
Delete(SParam, 1, Pos('=', SParam));
FOption_Encoding:= AppEncodingShortnameToFullname(SParam);
if FOption_Encoding='' then
MsgStdout('CudaText: unknown encoding name: '+SParam);
MsgStdout(Format(msgCommandLineUnknownEncoding, [SParam]));
Continue;
end;

{$ifdef darwin}
//macOS gives param -psn** for debugger
if SBeginsWith(SParam, '-psn') then Continue;
{$endif}

MsgStdout(Format(msgCommandLineUnknownOption, [SParam]));
Halt;
end;
Expand All @@ -82,11 +87,6 @@ begin
begin
fn:= ParamStrUTF8(i);

{$ifdef darwin}
//OSX 10.8 gives param "-psn**"
if SBeginsWith(fn, '-psn') then Continue;
{$endif}

//ignore special params
if SBeginsWith(fn, '-') then Continue;

Expand Down
2 changes: 2 additions & 0 deletions app/proc_msg.pas
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ interface

msgCommandLineUnknownOption =
'CudaText: unknown key %s'#10'Run "cudatext --help" to see command line help.';
msgCommandLineUnknownEncoding =
'CudaText: unknown encoding: %s';
msgCommandLineVersion =
'CudaText version %s';

Expand Down

0 comments on commit dcd6c0d

Please sign in to comment.