Skip to content

add context for the idx search command - #18366

Merged
fdncred merged 2 commits into
nushell:mainfrom
fdncred:add_context_to_idx_search
Jun 8, 2026
Merged

fdncred merged 2 commits into
nushell:mainfrom
fdncred:add_context_to_idx_search

Conversation

@fdncred

@fdncred fdncred commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR add the ability to have a "before_context" and "after_context" in the idx search command by using the --context/-c parameter and a range.

User-facing changes (Release notes)

Added --context support to idx search

Add context to your idx search queries by using --context/-c and a nushell range. The range has to be in the form of negative_number..positive_number where negative_number is the before lines to show and the positive_number is the after lines to show in the with_context record key.

Screenshot 2026-06-08 at 10-15-31

Additional notes

@fdncred fdncred added notes:ready Indicates Ready for Release notes notes:additions Noted in "Additions" section labels Jun 8, 2026
@fdncred

fdncred commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

I wonder if line should have a different name like hit or match?

@fdncred
fdncred merged commit bff3c32 into nushell:main Jun 8, 2026
18 checks passed
@fdncred
fdncred deleted the add_context_to_idx_search branch June 8, 2026 16:38
@github-actions github-actions Bot added this to the v0.114.0 milestone Jun 8, 2026
@Juhan280

Juhan280 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Can we also have int type, like --context 2 be equivalent to --context -2..2

@fdncred

fdncred commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

see #18368

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:additions Noted in "Additions" section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants