aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/tools/cli.ts23
1 files changed, 15 insertions, 8 deletions
diff --git a/server/tools/cli.ts b/server/tools/cli.ts
index a844b9dcf..7036ae3ec 100644
--- a/server/tools/cli.ts
+++ b/server/tools/cli.ts
@@ -73,16 +73,23 @@ function getRemoteObjectOrDie (
73): { url: string, username: string, password: string } { 73): { url: string, username: string, password: string } {
74 const options = program.opts() 74 const options = program.opts()
75 75
76 if (!options.url || !options.username || !options.password) { 76 const manualOptionMode = options.url || options.username || options.password
77 // No remote and we don't have program parameters: quit 77
78 if (settings.remotes.length === 0 || Object.keys(netrc.machines).length === 0) { 78 // Check parameters validity
79 if (!options.url) console.error('--url field is required.') 79 if (manualOptionMode || settings.remotes.length === 0 || Object.keys(netrc.machines).length === 0) {
80 if (!options.username) console.error('--username field is required.') 80 let exit = false
81 if (!options.password) console.error('--password field is required.') 81
82 82 for (const key of [ 'url', 'username', 'password' ]) {
83 return process.exit(-1) 83 if (!options[key]) {
84 console.error(`--${key} field is required`)
85 exit = true
86 }
84 } 87 }
85 88
89 if (exit) process.exit(-1)
90 }
91
92 if (!manualOptionMode) {
86 let url: string = options.url 93 let url: string = options.url
87 let username: string = options.username 94 let username: string = options.username
88 let password: string = options.password 95 let password: string = options.password