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

win32: Added Powershell way, WMIC still works #26

Closed
wants to merge 3 commits into from
Closed

win32: Added Powershell way, WMIC still works #26

wants to merge 3 commits into from

Conversation

erickriva
Copy link

No description provided.

const gateways = (gwArr.match(/"(.+?)"/g) || []).map(match => match.substring(1, match.length - 1));
let finalGwArr = gwArr;
if (command === "powershell") {
finalGwArr = `{ ${gwArr.replace(/[{}]/g, "").split(", ").map((value) => `"${value}"`).join(", ")} }`;
Copy link
Author

Choose a reason for hiding this comment

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

Powershell table doesn't show IP's between " ". Added it for powershell only. I can't find a better way.

@erickriva erickriva marked this pull request as draft February 16, 2022 14:52
function parseIfTable(ifTable) {
const line = (ifTable || "").trim().split("\n")[1];
function parseIfTable(ifTable, command) {
const line = (ifTable || "").trim().split("\n")[command === "powershell" ? 2 : 1];
Copy link
Author

@erickriva erickriva Feb 16, 2022

Choose a reason for hiding this comment

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

Powershell table 2nd line is a separator, like this: ----------
3rd line is the one with info needed.

@erickriva erickriva marked this pull request as ready for review February 16, 2022 15:02
@erickriva
Copy link
Author

erickriva commented Feb 16, 2022

Working fine here (with powershell)

image

@erickriva erickriva closed this by deleting the head repository Aug 30, 2022
@openspeedtest
Copy link

@silverwind Could you please test and merge this? Thank you @erickriva

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants