Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Windows Compatibility-Add PowerShell Script as an Alternative to Grep on Linux #690

Merged

Conversation

kthatipally
Copy link
Contributor

PR Summary
This pull request introduces a PowerShell-based alternative to the grep command, ensuring that the built-in File Searching feature is also compatible with Windows systems.

service_client.go: Added runOSSpecificGrepCommand to handle grep functionality for both Windows (using PowerShell) and Unix-based systems. This function checks for the OS platform and invokes powershell(windows) and grep(linux). Replaced direct grep command execution with runOSSpecificGrepCommand to support cross-platform compatibility.

service_client.go: Implemented parseGrepOutputForFileContent to parse the output from both PowerShell and grep. This enhancement not only refines the existing parsing mechanism for Linux but also accommodates Windows file path patterns and addresses issues with the split function when multiple ':' appear in the input.

WIP: Testing

@kthatipally kthatipally changed the title [Windows Compatibility] Add PowerShell Script as an Alternative to Grep on Linux Non-breaking feature: [Windows Compatibility] Add PowerShell Script as an Alternative to Grep on Linux Aug 12, 2024
@kthatipally kthatipally changed the title Non-breaking feature: [Windows Compatibility] Add PowerShell Script as an Alternative to Grep on Linux (:sparkles:) [Windows Compatibility] Add PowerShell Script as an Alternative to Grep on Linux Aug 12, 2024
@kthatipally kthatipally changed the title (:sparkles:) [Windows Compatibility] Add PowerShell Script as an Alternative to Grep on Linux :sparkles: [Windows Compatibility] Add PowerShell Script as an Alternative to Grep on Linux Aug 12, 2024
@kthatipally kthatipally changed the title :sparkles: [Windows Compatibility] Add PowerShell Script as an Alternative to Grep on Linux ✨ [Windows Compatibility] Add PowerShell Script as an Alternative to Grep on Linux Aug 12, 2024
@kthatipally kthatipally changed the title ✨ [Windows Compatibility] Add PowerShell Script as an Alternative to Grep on Linux ✨ Windows Compatibility-Add PowerShell Script as an Alternative to Grep on Linux Aug 12, 2024
Copy link
Contributor

@shawn-hurley shawn-hurley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good assuming the power shell code works.

Another option if you were interested in doing, is to create a new "grep_windows.go" and "grep_nix.go" that will compile grep_nix using build tags when on a nix system and windows when on windows.

This is a decent resource to see what I mean: https://dave.cheney.net/2013/10/12/how-to-use-conditional-compilation-with-the-go-build-tool

I think that we can do this as a follow up though if we want

@kthatipally kthatipally marked this pull request as ready for review November 25, 2024 03:11
@kthatipally kthatipally force-pushed the add-powershell-alternative-to-grep branch from e471059 to 5b7b589 Compare November 25, 2024 03:13
@kthatipally kthatipally changed the title ✨ Windows Compatibility-Add PowerShell Script as an Alternative to Grep on Linux ✨ Windows Compatibility-Add PowerShell Script as an Alternative to Grep on Linux Nov 25, 2024
@eemcmullan eemcmullan added the cherry-pick/release-0.6 This PR should be cherry-picked to release-0.6 branch label Nov 25, 2024
…ript as an alternative to grep

Signed-off-by: kthatipally <[email protected]>
Signed-off-by: kthatipally <[email protected]>
@kthatipally kthatipally force-pushed the add-powershell-alternative-to-grep branch from 5b7b589 to c9dab07 Compare November 26, 2024 02:08
@eemcmullan eemcmullan merged commit 80d7fb0 into konveyor:main Nov 26, 2024
10 checks passed
eemcmullan pushed a commit to eemcmullan/analyzer-lsp that referenced this pull request Nov 26, 2024
…ep on Linux (konveyor#690)

PR Summary
This pull request introduces a PowerShell-based alternative to the grep
command, ensuring that the built-in File Searching feature is also
compatible with Windows systems.

service_client.go: Added runOSSpecificGrepCommand to handle grep
functionality for both Windows (using PowerShell) and Unix-based
systems. This function checks for the OS platform and invokes
powershell(windows) and grep(linux). Replaced direct grep command
execution with runOSSpecificGrepCommand to support cross-platform
compatibility.

service_client.go: Implemented parseGrepOutputForFileContent to parse
the output from both PowerShell and grep. This enhancement not only
refines the existing parsing mechanism for Linux but also accommodates
Windows file path patterns and addresses issues with the split function
when multiple ':' appear in the input.

WIP: Testing

---------

Signed-off-by: kthatipally <[email protected]>
eemcmullan pushed a commit to eemcmullan/analyzer-lsp that referenced this pull request Nov 26, 2024
…ep on Linux (konveyor#690)

PR Summary
This pull request introduces a PowerShell-based alternative to the grep
command, ensuring that the built-in File Searching feature is also
compatible with Windows systems.

service_client.go: Added runOSSpecificGrepCommand to handle grep
functionality for both Windows (using PowerShell) and Unix-based
systems. This function checks for the OS platform and invokes
powershell(windows) and grep(linux). Replaced direct grep command
execution with runOSSpecificGrepCommand to support cross-platform
compatibility.

service_client.go: Implemented parseGrepOutputForFileContent to parse
the output from both PowerShell and grep. This enhancement not only
refines the existing parsing mechanism for Linux but also accommodates
Windows file path patterns and addresses issues with the split function
when multiple ':' appear in the input.

WIP: Testing

---------

Signed-off-by: kthatipally <[email protected]>
Signed-off-by: Emily McMullan <[email protected]>
eemcmullan pushed a commit to eemcmullan/analyzer-lsp that referenced this pull request Nov 26, 2024
…ep on Linux (konveyor#690)

PR Summary
This pull request introduces a PowerShell-based alternative to the grep
command, ensuring that the built-in File Searching feature is also
compatible with Windows systems.

service_client.go: Added runOSSpecificGrepCommand to handle grep
functionality for both Windows (using PowerShell) and Unix-based
systems. This function checks for the OS platform and invokes
powershell(windows) and grep(linux). Replaced direct grep command
execution with runOSSpecificGrepCommand to support cross-platform
compatibility.

service_client.go: Implemented parseGrepOutputForFileContent to parse
the output from both PowerShell and grep. This enhancement not only
refines the existing parsing mechanism for Linux but also accommodates
Windows file path patterns and addresses issues with the split function
when multiple ':' appear in the input.

WIP: Testing

---------

Signed-off-by: kthatipally <[email protected]>
Signed-off-by: Emily McMullan <[email protected]>
eemcmullan added a commit that referenced this pull request Nov 26, 2024
…t… (#739)

Signed-off-by: kthatipally <[email protected]>
Signed-off-by: Emily McMullan <[email protected]>
Co-authored-by: Keerthi Thatipally <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick/release-0.6 This PR should be cherry-picked to release-0.6 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants