FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
angular-cli/packages/@angular/cli/commands/help.ts at master · feicc/angular-cli · GitHub
feicc
/
angular-cli
Public
forked from
angular/angular-cli
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
92
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
angular-cli
/
packages
/
@angular
/
cli
/
commands
/
help.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
88 lines (72 loc) · 2.49 KB
Breadcrumbs
angular-cli
/
packages
/
@angular
/
cli
/
commands
/
help.ts
Copy path
File metadata and controls
88 lines (72 loc) · 2.49 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
77
78
79
80
81
82
83
84
85
86
87
88
import
*
as
fs
from
'fs'
;
import
*
as
path
from
'path'
;
const
Command
=
require
(
'../ember-cli/lib/models/command'
)
;
const
stringUtils
=
require
(
'ember-cli-string-utils'
)
;
const
lookupCommand
=
require
(
'../ember-cli/lib/cli/lookup-command'
)
;
const
HelpCommand
=
Command
.
extend
(
{
name
:
'help'
,
description
:
'Shows help for the CLI.'
,
works
:
'everywhere'
,
availableOptions
:
[
{
name
:
'short'
,
type
:
Boolean
,
default
:
false
,
aliases
:
[
's'
]
,
description
:
'Display command name and description only.'
}
,
]
,
anonymousOptions
:
[
'command-name (Default: all)'
]
,
run
:
function
(
commandOptions
:
any
,
rawArgs
:
any
)
{
let
commandFiles
=
fs
.
readdirSync
(
__dirname
)
// Remove files that are not JavaScript or Typescript
.
filter
(
file
=>
file
.
match
(
/
\.
(
j
|
t
)
s
$
/
)
&&
!
file
.
match
(
/
\.
d
.
t
s
$
/
)
)
.
map
(
file
=>
path
.
parse
(
file
)
.
name
)
.
map
(
file
=>
file
.
toLowerCase
(
)
)
;
let
commandMap
=
commandFiles
.
reduce
(
(
acc
:
any
,
curr
:
string
)
=>
{
let
classifiedName
=
stringUtils
.
classify
(
curr
)
;
let
defaultImport
=
require
(
`./
${
curr
}
`
)
.
default
;
acc
[
classifiedName
]
=
defaultImport
;
return
acc
;
}
,
{
}
)
;
if
(
rawArgs
.
indexOf
(
'all'
)
!==
-
1
)
{
rawArgs
=
[
]
;
// just act as if command not specified
}
commandFiles
.
forEach
(
cmd
=>
{
const
Command
=
lookupCommand
(
commandMap
,
cmd
)
;
const
command
=
new
Command
(
{
ui
:
this
.
ui
,
project
:
this
.
project
,
commands
:
this
.
commands
,
tasks
:
this
.
tasks
}
)
;
if
(
command
.
hidden
||
command
.
unknown
)
{
return
;
}
if
(
rawArgs
.
length
>
0
)
{
let
commandInput
=
rawArgs
[
0
]
;
const
aliases
=
Command
.
prototype
.
aliases
;
if
(
aliases
&&
aliases
.
indexOf
(
commandInput
)
>
-
1
)
{
commandInput
=
Command
.
prototype
.
name
;
}
if
(
cmd
===
commandInput
)
{
if
(
commandOptions
.
short
)
{
this
.
ui
.
writeLine
(
command
.
printShortHelp
(
commandOptions
)
)
;
}
else
if
(
command
.
printDetailedHelp
(
commandOptions
)
)
{
this
.
ui
.
writeLine
(
command
.
printDetailedHelp
(
commandOptions
)
)
;
}
else
{
this
.
ui
.
writeLine
(
command
.
printBasicHelp
(
commandOptions
)
)
;
}
}
}
else
{
if
(
commandOptions
.
short
)
{
this
.
ui
.
writeLine
(
command
.
printShortHelp
(
commandOptions
)
)
;
}
else
{
this
.
ui
.
writeLine
(
command
.
printBasicHelp
(
commandOptions
)
)
;
}
}
}
)
;
}
}
)
;
HelpCommand
.
overrideCore
=
true
;
export
default
HelpCommand
;
Back
|
FazBrowse Home
|
New Git URL