Skip to content

Commit c86314e

Browse files
committed
builtin completion
1 parent df68f59 commit c86314e

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

app/EchoCommand.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ class EchoCommand extends Command {
1010
const output = args.join(' ');
1111
// Only write to stdout, never to stderr
1212
if (!this.outputHandler.isStderr) {
13-
this.outputHandler.write(output);
13+
this.outputHandler.write(output, true, true);
1414
} else {
1515
// If stderr is redirected, write to stdout anyway
16-
console.log('here dave');
17-
this.outputHandler.writeError(output + '\n');
16+
this.outputHandler.writeError(output, true, true);
1817
}
1918
return { shouldContinue: true };
2019
}

app/OutputHandler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class OutputHandler {
6565
}
6666
}
6767

68-
writeError(message, newLine = true) {
68+
writeError(message, newLine = true, printToOutput = false) {
6969
// If this is a stderr handler with redirection, write to file
7070
if (this.isStderr && this.outputFile) {
7171
// Ensure file is initialized first
@@ -75,6 +75,7 @@ class OutputHandler {
7575
if (this.fileInitialized) {
7676
const content = newLine ? message + '\n' : message;
7777
fs.appendFileSync(this.outputFile, content);
78+
if (printToOutput) process.stdout.write(content);
7879
} else {
7980
// Fall back to stderr console
8081
process.stderr.write(newLine ? message + '\n' : message);

foo.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
david says error
2+
dave stay
3+
dave sta
4+
dave dstas
5+
dave eehe
6+
dafdf fkjfk
7+
dajbeb
8+
ejfrklfj
9+
ffkrgjrfk

0 commit comments

Comments
 (0)