mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-12 15:57:43 +02:00
Split exec
This commit is contained in:
@@ -77,7 +77,7 @@ module.exports = class EvalCommand extends Command {
|
||||
}
|
||||
}
|
||||
|
||||
makeResultMessages(result, hrDiff, input = null) {
|
||||
makeResultMessages(result, hrDiff, input = null, lang = 'javascript') {
|
||||
const inspected = util.inspect(result, { depth: 0 })
|
||||
.replace(nlPattern, '\n')
|
||||
.replace(this.sensitivePattern, '--snip--');
|
||||
@@ -87,19 +87,19 @@ module.exports = class EvalCommand extends Command {
|
||||
const appendPart = inspected[last] !== '}' && inspected[last] !== ']' && inspected[last] !== '\''
|
||||
? split[split.length - 1]
|
||||
: inspected[last];
|
||||
const prepend = `\`\`\`javascript\n${prependPart}\n`;
|
||||
const prepend = `\`\`\`${lang}\n${prependPart}\n`;
|
||||
const append = `\n${appendPart}\n\`\`\``;
|
||||
if (input) {
|
||||
return Util.splitMessage(tags.stripIndents`
|
||||
*Executed in ${hrDiff[0] > 0 ? `${hrDiff[0]}s ` : ''}${hrDiff[1] / 1000000}ms.*
|
||||
\`\`\`javascript
|
||||
\`\`\`${lang}
|
||||
${inspected}
|
||||
\`\`\`
|
||||
`, { maxLength: 1900, prepend, append });
|
||||
} else {
|
||||
return Util.splitMessage(tags.stripIndents`
|
||||
*Callback executed after ${hrDiff[0] > 0 ? `${hrDiff[0]}s ` : ''}${hrDiff[1] / 1000000}ms.*
|
||||
\`\`\`javascript
|
||||
\`\`\`${lang}
|
||||
${inspected}
|
||||
\`\`\`
|
||||
`, { maxLength: 1900, prepend, append });
|
||||
|
||||
Reference in New Issue
Block a user