Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
ece91511
Commit
ece91511
authored
4 weeks ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
Clean up comments, unnecessary opt object property init, usage output
parent
67f8cbe4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/tdfiglet.js
+13
-26
13 additions, 26 deletions
exec/tdfiglet.js
with
13 additions
and
26 deletions
exec/tdfiglet.js
+
13
−
26
View file @
ece91511
...
@@ -7,40 +7,27 @@
...
@@ -7,40 +7,27 @@
var
tdf
=
load
(
"
tdfonts_lib.js
"
);
var
tdf
=
load
(
"
tdfonts_lib.js
"
);
// Global options object (using var)
tdf
.
opt
=
{};
tdf
.
opt
=
{
justify
:
LEFT_JUSTIFY
,
random
:
false
,
info
:
false
};
// Function declarations (Synchronet JS style)
function
usage
()
{
function
usage
()
{
writeln
(
"
usage: [options] input
"
);
writeln
(
"
usage:
tdfiglet
[options] input
"
);
writeln
(
""
);
writeln
(
""
);
writeln
(
"
-f [font] Specify font file use
d.
"
);
writeln
(
"
-f [font] Specify font file
to
use
"
);
writeln
(
"
-j l|r|c Justify left, right, or center
. D
efault
is
left
.
"
);
writeln
(
"
-j l|r|c Justify left, right, or center
(d
efault
:
left
)
"
);
writeln
(
"
-w n Set screen width
. D
efault
is
auto-detect or 80
.
"
);
writeln
(
"
-w n Set screen width
(d
efault
:
auto-detect or 80
)
"
);
writeln
(
"
-m n Set margin/offset (for left or right justification)
.
"
);
writeln
(
"
-m n Set margin/offset (for left or right justification)
"
);
writeln
(
"
-a
Color
sequences
: ANSI. D
efault
is
Synchronet Ctrl-A
.
"
);
writeln
(
"
-a
Enable ANSI
sequences
(d
efault
:
Synchronet Ctrl-A
)
"
);
writeln
(
"
-u Encode charaters as UTF-8
. D
efault
is
CP437
.
"
);
writeln
(
"
-u Encode chara
c
ters as UTF-8
(d
efault
:
CP437
)
"
);
writeln
(
"
-x n Index to font within file
. D
efault
is
0
.
"
);
writeln
(
"
-x n Index to font within file
(d
efault
:
0
)
"
);
writeln
(
"
-i Print font details
.
"
);
writeln
(
"
-i Print font details
"
);
writeln
(
"
-r Use random font
.
"
);
writeln
(
"
-r Use random font
and/or index (if not specified with -x)
"
);
writeln
(
"
-h Print usage
.
"
);
writeln
(
"
-h Print usage
"
);
writeln
(
""
);
writeln
(
""
);
exit
(
1
);
// Use Synchronet's exit
exit
(
1
);
}
}
// Main execution block (equivalent to C main function)
// Access command line arguments via argv global
// argv[0] is typically the script name in Synchronet JS
// Subsequent elements are the arguments
var
fontfile
=
null
;
var
fontfile
=
null
;
// Corrected argument parsing: Explicitly consume options and their arguments.
var
input_string
=
""
;
var
input_string
=
""
;
for
(
i
=
0
;
i
<
argv
.
length
;
++
i
)
{
for
(
i
=
0
;
i
<
argv
.
length
;
++
i
)
{
var
arg
=
argv
[
i
];
var
arg
=
argv
[
i
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment