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

[types] add ipaddr and ipnet types #1946

Merged
merged 4 commits into from
Jul 2, 2023

Conversation

ajkerrigan
Copy link
Collaborator

  • Handle IPv4 and IPv6 addresses
  • Include a select-supernets command to select rows containing an input network

This is mostly a copy/paste of the example here, plus a suggestion from Saul and a couple docstrings / safety checks / style tweaks that seem to make it more suitable for inclusion in core. Suggestions for alternatives/additions/further tweaks welcome of course.

Closes #1782, and also relates to #1910

- Handle IPv4 and IPv6 addresses
- Include a `select-supernets` command to select rows containing
  an input network
TableSheet.addCommand(
None,
"select-supernets",
'cursorCol.selectSupernets(inputExpr("ip or cidr block: "))',
Copy link
Owner

Choose a reason for hiding this comment

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

We should use input rather than inputExpr, since it's not an expression (and won't benefit from e.g. tab-completion of column names). Also let's add a type="ip" so that the history can be limited to ip addresses.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah right, good call. I also need to dig into the test failures which at a glance seem to stem from assuming that ipaddress will be globally available.

Copy link
Owner

Choose a reason for hiding this comment

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

addGlobals(ipaddress=ipaddress) should cover that.

Copy link
Owner

@saulpw saulpw left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for putting this together, @ajkerrigan !

@ajkerrigan ajkerrigan merged commit 040ab8c into saulpw:develop Jul 2, 2023
13 checks passed
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.

Type as: IPv4
2 participants