Skip to content

Commit cf64d50

Browse files
committed
Merge branch 'main' into copilot/support-restarting-shell
2 parents d9bb14d + e110626 commit cf64d50

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
20+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2121

2222
- name: Check existence of composer.json file
2323
id: check_composer_file

features/shell.feature

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,20 @@ Feature: WordPress REPL
9797
"""
9898
exit
9999
"""
100+
101+
Scenario: Input starting with dash
102+
Given a WP install
103+
And a session file:
104+
"""
105+
-1
106+
"""
107+
108+
When I run `wp shell --basic < session`
109+
Then STDOUT should contain:
110+
"""
111+
int(-1)
112+
"""
113+
And STDERR should not contain:
114+
"""
115+
history: -1: invalid option
116+
"""

src/WP_CLI/Shell/REPL.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private static function create_prompt_cmd( $prompt, $history_path ) {
169169
. 'LINE=""; '
170170
. "read -re -p {$prompt} LINE; "
171171
. '[ $? -eq 0 ] || exit; '
172-
. 'history -s "$LINE"; '
172+
. 'history -s -- "$LINE"; '
173173
. "history -w {$history_path}; "
174174
. 'echo $LINE; ';
175175

0 commit comments

Comments
 (0)