brona / iproute2mac

CLI wrapper for basic network utilites on Mac OS X inspired with iproute2 on Linux systems - ip command.
MIT License
898 stars 73 forks source link

Use iproute2 command processing #15

Closed deployable closed 7 years ago

deployable commented 7 years ago

Adds support for arbitrary length command shortcuts.

iproute2 uses a matches function for it's command processing which looks equivelent to using string .startswith().

Command order has also been matched to iproute2 as the shortcuts depend on order.

Fixes #14

brona commented 7 years ago

Regarding the arbitrary length shortcuts - this was the first implementation I had however i changed to lists the options to better replicate behaviour of iproute2 see http://www.policyrouting.org/iproute2.doc.html and Abbervations

I think we should do our best to replicate iproute2 cli.. what do you think?

deployable commented 7 years ago

Agreed, the iproute2 cli does support arbitrary length abbreviations in the code though.

In the code all commands are listed in their full form and then the matches function performs the comparison on the characters the user provides in argv which this PR is emulating. I guess the the documentation only lists a subset of abbreviations for for brevity :)??

For some reason I've got into the habit of using 2 letters for most ip commands on linux, which generally fail in the script.

brona commented 7 years ago

PR Merged, thank you for the contribution. You will be listed in AUTHORS file.

deployable commented 7 years ago

Cheers. Thank you for the script!

brona commented 7 years ago

Just released v1.2.1 and PR submitted to homebrew-core