mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: print hints one by one, fix unexpected breakline
This commit is contained in:
1 parent
fc13e9371c
commit
a9a63ea164
2 files changed
+13
-10
No files matched your search
@@ -3,7 +3,7 @@ const fs = require('fs').promises
|
||||
const { exit } = require('process')
|
||||
const minimist = require('minimist')
|
||||
const axios = require('axios')
|
||||
const { colorize, printResponses } = require('./print.js')
|
||||
const { colorize, printResponses, printHints } = require('./print.js')
|
||||
const discoverFiles = require('./discover.js')
|
||||
|
||||
async function readOrNone(file) {
|
||||
@@ -66,16 +66,14 @@ async function main() {
|
||||
const { responses, hints, end } = res.data
|
||||
if (responses) {
|
||||
await printResponses(responses, 60)
|
||||
await api.post('/commands/completed')
|
||||
}
|
||||
if (hints) {
|
||||
for (const hint of hints) {
|
||||
console.log(colorize(hint, 'yellow'))
|
||||
}
|
||||
await printHints(hints, 60)
|
||||
}
|
||||
if (end) {
|
||||
console.log(colorize('Quest completed!', 'blue'))
|
||||
}
|
||||
await api.post('/commands/completed')
|
||||
} catch (err) {
|
||||
if (err.response) {
|
||||
console.error(err.response.data)
|
||||
|
||||
Reference in new issue
Block a user