Skip to content

Commit b43370c

Browse files
authored
Merge pull request #78 from wp-cli/copilot/fix-1570774-85307675-a3581af5-4b01-4bc1-9e7d-38e6e62dd0d1
2 parents 80d798c + 9de2149 commit b43370c

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

features/shell.feature

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,20 @@ Feature: WordPress REPL
6060
bool(true)
6161
"""
6262
And STDERR should be empty
63+
64+
Scenario: Input starting with dash
65+
Given a WP install
66+
And a session file:
67+
"""
68+
-1
69+
"""
70+
71+
When I run `wp shell --basic < session`
72+
Then STDOUT should contain:
73+
"""
74+
int(-1)
75+
"""
76+
And STDERR should not contain:
77+
"""
78+
history: -1: invalid option
79+
"""

src/WP_CLI/Shell/REPL.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private static function create_prompt_cmd( $prompt, $history_path ) {
137137
. 'LINE=""; '
138138
. "read -re -p {$prompt} LINE; "
139139
. '[ $? -eq 0 ] || exit; '
140-
. 'history -s "$LINE"; '
140+
. 'history -s -- "$LINE"; '
141141
. "history -w {$history_path}; "
142142
. 'echo $LINE; ';
143143

0 commit comments

Comments
 (0)