--help
Massimo Melina committed
Jan 3, 2025 at 19:50 UTC
602c8fdaebb043aead031524bb199c33d06e855e
2 files changed
+19
-2
src/commands.ts
+2
-2
@@ -1,7 +1,7 @@
1
// This file is part of HFS - Copyright 2021-2023, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
2
3
import { createAdmin, getAccount, updateAccount } from './perm'
4
-import { configKeyExists, setConfig, getWholeConfig } from './config'
4
+import { configKeyExists, setConfig, getWholeConfig, showHelp } from './config'
5
import _ from 'lodash'
6
import { getUpdates, update } from './update'
7
import { openAdmin } from './listen'
@@ -15,7 +15,7 @@ import { Dict, formatBytes, formatSpeed, formatTimestamp, makeMatcher } from './
15
import apiMonitor from './api.monitor'
16
import { argv } from './argv'
17
18
-if (!argv.updating)
18
+if (!argv.updating && !showHelp)
19
try {
20
/*
21
is this try-block useful in case the stdin is unavailable?
src/config.ts
+17
@@ -195,4 +195,21 @@ export const configFile = watchLoad(filePath, text => {
195
setTimeout(() => // this is called synchronously, but we need to call setConfig after first tick, when all configs are defined
196
setConfig({}, false))
197
}
198
+})
199
+
200
+export const showHelp = argv.help
201
+events.on('configReady', () => {
202
+ if (!showHelp) return
203
+ console.log(`HELP
204
+You can pass any configuration in the form: --name value
205
+Most common configurations:
206
+ --create-admin <password>
207
+ --port <port>
208
+ --cert <path>
209
+ --private_key <path>
210
+ --consoleFile <path>
211
+
212
+For a description of each configuration, please refer to https://rejetto.com/hfs-config
213
+ `)
214
+ process.exit(0)
215
})
\ No newline at end of file