Skip to content

Commit f299849

Browse files
committed
add -f and -op options to the CLI
1 parent a4c4a17 commit f299849

File tree

2 files changed

+51
-16
lines changed

2 files changed

+51
-16
lines changed

‎lib/command.coffee‎

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,42 @@ runner = ->
2626
{
2727
short: "p"
2828
long: "port"
29-
description: "Specify the port"
29+
description: "Specify the port the server should listen on."
3030
value: true
3131
required: false
3232
}
3333
{
3434
short: "x"
3535
long: "exclusions"
36-
description: "Exclude files by specifying an array of regular expressions. Will be appended to default value which is [/\.git\//, /\.svn\//, /\.hg\//]",
36+
description: "Exclude files from being watched by specifying an array of regular expressions. Will be appended to default value which is [/\.git\//, /\.svn\//, /\.hg\//]",
3737
required: false,
3838
value: true
3939
}
4040
{
4141
short: "d"
4242
long: "debug"
43-
description: "Additional debugging information",
43+
description: "See helpful debugging information",
4444
required: false,
4545
callback: -> debug = true
4646
}
4747
{
4848
short: "e"
4949
long: "exts",
50-
description: "A comma-separated list of extensions you wish to watch. Replaces default extentions",
50+
description: "A comma-separated list of extensions that should trigger a reload when changed. Replaces default extentions",
5151
required: false,
5252
value: true
5353
}
5454
{
5555
short: "ee"
5656
long: "extraExts",
57-
description: "A comma-separated list of extensions you wish to watch in addition to the defaults (html, css, js, png, gif, jpg, php, php5, py, rb, erb, coffee). If used with --exts, this overrides --exts.",
57+
description: "A comma-separated list of extensions that should trigger a reload when changed, in addition to the defaults (html, css, js, png, gif, jpg, php, php5, py, rb, erb, coffee). If used with --exts, this overrides --exts.",
58+
required: false,
59+
value: true
60+
}
61+
{
62+
short: "f"
63+
long: "filesToReload",
64+
description: "A comma-separated list of filenames that should trigger a reload when changed.",
5865
required: false,
5966
value: true
6067
}
@@ -68,10 +75,17 @@ runner = ->
6875
{
6976
short: "w"
7077
long: "wait"
71-
description: "delay message of file system changes to browser by `delay` milliseconds"
78+
description: "Delay message of file system changes to browser by `delay` milliseconds"
7279
required: false
7380
value: true
7481
}
82+
{
83+
short: "op"
84+
long: "originalpath",
85+
description: "Set a URL you use for development, e.g 'http:/domain.com', then LiveReload will proxy this url to local path."
86+
required: false,
87+
value: true
88+
}
7589
]
7690

7791
opts.parse(options.reverse(), args, true)
@@ -84,8 +98,10 @@ runner = ->
8498
exclusions = if opts.get('exclusions') then opts.get('exclusions' ).split(',' ).map((s) -> new RegExp(s)) else []
8599
exts = if opts.get('exts') then opts.get('exts').split(',').map((ext) -> ext.trim()) else []
86100
extraExts = if opts.get('extraExts') then opts.get('extraExts').split(',').map((ext) -> ext.trim()) else []
101+
filesToReload = if opts.get('filesToReload') then opts.get('filesToReload').split(',').map((file) -> file.trim()) else []
87102
usePolling = opts.get('usepolling') || false
88-
wait = opts.get('wait') || 0;
103+
wait = opts.get('wait') || 0
104+
originalPath = opts.get('originalPath') || ''
89105

90106
server = livereload.createServer({
91107
port: port
@@ -94,10 +110,11 @@ runner = ->
94110
exts: exts
95111
extraExts: extraExts
96112
usePolling: usePolling
113+
filesToReload: filesToReload
97114
delay: wait
115+
originalPath: originalPath
98116
})
99117

100-
101118
console.log "Starting LiveReload v#{version} for #{path} on port #{port}."
102119

103120
server.on 'error', (err) ->

‎lib/command.js‎

Lines changed: 26 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)