Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Languages/Bash/Patterns/BashFlagPattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@

#[PatternTest(input: 'ls -la', output: '-la')]
#[PatternTest(input: 'grep --color=auto', output: '--color')]
#[PatternTest(input: './tempest mcp:serve demo-server', output: null)]
final readonly class BashFlagPattern implements Pattern
{
use IsPattern;

public function getPattern(): string
{
return '(?<match>--?[a-zA-Z][\w-]*)';
return '(?<match>(?<![\w-])--?[a-zA-Z][\w-]*)';
}

public function getTokenType(): TokenTypeEnum
Expand Down
2 changes: 1 addition & 1 deletion tests/Languages/Terminal/TerminalLanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static function provide_highlight_cases(): iterable
$ mkdir build; cd build
TXT,
<<<'TXT'
<span class="hl-comment">$</span> <span class="hl-keyword">npx</span> husky<span class="hl-generic">-init</span> <span class="hl-operator">&amp;&amp;</span> <span class="hl-keyword">npm</span> install
<span class="hl-comment">$</span> <span class="hl-keyword">npx</span> husky-init <span class="hl-operator">&amp;&amp;</span> <span class="hl-keyword">npm</span> install
<span class="hl-comment">$</span> <span class="hl-keyword">echo</span> <span class="hl-value">&quot;hello&quot;</span> <span class="hl-operator">||</span> <span class="hl-keyword">echo</span> <span class="hl-value">&quot;fallback&quot;</span>
<span class="hl-comment">$</span> <span class="hl-keyword">mkdir</span> build<span class="hl-operator">;</span> <span class="hl-keyword">cd</span> build
TXT],
Expand Down
Loading