FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ionic-docs/scripts/cliDocgen.ts at master · lawrencetaur/ionic-docs · GitHub
lawrencetaur
/
ionic-docs
Public
forked from
ionic-team/ionic-docs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
ionic-docs
/
scripts
/
cliDocgen.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
76 lines (61 loc) · 2.04 KB
Breadcrumbs
ionic-docs
/
scripts
/
cliDocgen.ts
Copy path
File metadata and controls
76 lines (61 loc) · 2.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
export
function
getVersionMarkup
(
command
)
:
string
{
let
markdown
=
`#
${
command
.
name
}
\n\n`
;
markdown
+=
`\`
${
command
.
name
}
`
;
markdown
+=
command
.
inputs
.
map
(
input
=>
input
.
required
?
`<
${
input
.
name
}
>`
:
`[<
${
input
.
name
}
>]`
)
.
join
(
' '
)
;
markdown
+=
command
.
options
&&
command
.
options
.
length
?
' [options]'
:
''
;
markdown
+=
'`\n\n'
;
if
(
command
.
summary
)
{
markdown
+=
`<p class="intro"><strong>
${
command
.
summary
}
</strong></p>\n\n`
;
}
if
(
command
.
description
)
{
markdown
+=
'<p class="intro">'
+
command
.
description
.
replace
(
/
\n
\n
/
g
,
'</p>\n<p class="intro">'
)
.
replace
(
/
\n
\\
\[
(
[
2
-
9
]
)
/
g
,
'<br>\n\\\[$1'
)
.
replace
(
/
&
a
m
p
;
/
g
,
'&'
)
.
replace
(
/
&
g
t
;
/
g
,
'>'
)
.
replace
(
/
&
l
t
;
/
g
,
'<'
)
.
replace
(
/
\n
-
/
g
,
'</p>\n\n- '
)
.
replace
(
/
(
-
.
*
?
)
<
\/
p
>
\n
/
g
,
'$1\n\n'
)
;
markdown
+=
`\n</p>\n\n`
;
}
if
(
command
.
exampleCommands
.
length
)
{
markdown
+=
'## Examples\n\n'
;
markdown
+=
'```shell\n'
;
markdown
+=
command
.
exampleCommands
.
map
(
cmd
=>
`$
${
cmd
}
`
)
.
join
(
'\n'
)
;
markdown
+=
'\n```\n\n'
;
}
markdown
+=
generateInputsList
(
command
.
inputs
)
;
markdown
+=
generateOptionsList
(
command
.
options
)
;
return
markdown
;
}
function
generateInputsList
(
inputs
)
{
if
(
!
inputs
.
length
)
return
''
;
let
str
=
`## Inputs\n\n<dl>\n\n`
;
for
(
const
input
of
inputs
)
{
str
+=
`<dt><h4>
${
input
.
name
}
</h4>`
;
if
(
input
.
required
)
{
str
+=
`**Required:** \`true\`\n`
;
}
str
+=
`</dt>\n`
;
str
+=
`<dd>
${
input
.
summary
}
</dd>\n\n`
;
}
return
str
+
'</dl>\n\n\n'
;
}
function
generateOptionsList
(
options
)
{
if
(
!
options
.
length
)
return
''
;
let
str
=
`## Options\n\n<dl>\n\n`
;
for
(
const
option
of
options
)
{
str
+=
`<dt><h4>--
${
option
.
type
===
'boolean'
&&
option
.
default
?
'no-'
:
''
}
${
option
.
name
}
</h4>`
;
if
(
option
.
aliases
.
length
)
{
str
+=
`**Alias:** \`-
${
option
.
aliases
.
join
(
', -'
)
}
\`\n`
;
}
if
(
option
.
type
)
{
str
+=
`**Type:** \`
${
option
.
type
}
\`\n`
;
}
str
+=
`</dt>\n`
;
str
+=
`<dd>
${
option
.
summary
}
</dd>\n\n`
;
}
return
str
+
'</dl>\n\n\n'
;
}
Back
|
FazBrowse Home
|
New Git URL