Skip to content

Commit e145262

Browse files
feat: add CLI feedback when waiting for stdin input
- Detects interactive TTY sessions and prints a helpful message to stderr when the command is waiting for input. - Prevents user confusion when running commands without arguments or pipes. - Adds test case to verify the behavior (mocking isTTY). - Handles platform-specific EOF instructions (Ctrl+Z for Windows, Ctrl+D for others). - Verifies macOS behavior via specific test case. - Ensures all tests pass linting (no unused variables).
1 parent 473f473 commit e145262

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/commands/unipept/unipept_subcommand.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe('UnipeptSubcommand', () => {
7575
// Mock process.stderr.write
7676
const stderrSpy = vi.spyOn(process.stderr, 'write').mockImplementation(() => true);
7777

78-
const input = command["getInputIterator"]([]) as AsyncIterableIterator<string>;
78+
command["getInputIterator"]([]);
7979

8080
expect(stderrSpy).toHaveBeenCalledWith(expect.stringContaining("Reading from standard input..."));
8181

@@ -90,7 +90,7 @@ describe('UnipeptSubcommand', () => {
9090

9191
const stderrSpy = vi.spyOn(process.stderr, 'write').mockImplementation(() => true);
9292

93-
const input = command["getInputIterator"]([]) as AsyncIterableIterator<string>;
93+
command["getInputIterator"]([]);
9494

9595
expect(stderrSpy).toHaveBeenCalledWith(expect.stringContaining("Ctrl+Z, Enter"));
9696

@@ -105,7 +105,7 @@ describe('UnipeptSubcommand', () => {
105105

106106
const stderrSpy = vi.spyOn(process.stderr, 'write').mockImplementation(() => true);
107107

108-
const input = command["getInputIterator"]([]) as AsyncIterableIterator<string>;
108+
command["getInputIterator"]([]);
109109

110110
expect(stderrSpy).toHaveBeenCalledWith(expect.stringContaining("Ctrl+D"));
111111

@@ -120,7 +120,7 @@ describe('UnipeptSubcommand', () => {
120120

121121
const stderrSpy = vi.spyOn(process.stderr, 'write').mockImplementation(() => true);
122122

123-
const input = command["getInputIterator"]([]) as AsyncIterableIterator<string>;
123+
command["getInputIterator"]([]);
124124

125125
expect(stderrSpy).toHaveBeenCalledWith(expect.stringContaining("Ctrl+D"));
126126

@@ -136,7 +136,7 @@ describe('UnipeptSubcommand', () => {
136136
// Mock process.stderr.write
137137
const stderrSpy = vi.spyOn(process.stderr, 'write').mockImplementation(() => true);
138138

139-
const input = command["getInputIterator"]([]) as AsyncIterableIterator<string>;
139+
command["getInputIterator"]([]);
140140

141141
expect(stderrSpy).not.toHaveBeenCalled();
142142

0 commit comments

Comments
 (0)