v0.1.1
ADDED: * The -s/--size argument to the VLSM splitter may now be a comma-delimited list of sizes instead of needing to specify -s/--size for each size. This change is backwards-compatible.
This commit is contained in:
26
cmd/subnetter/funcs_vlsmargs.go
Normal file
26
cmd/subnetter/funcs_vlsmargs.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
/*
|
||||
AllSizes returns a properly parsed and consolidated slice
|
||||
of all specified sizes, as it takes two valid syntaxes (`-s 32 -s 32`, `-s 32,32`)
|
||||
that can be mixed together.
|
||||
*/
|
||||
func (v *VLSMArgs) AllSizes() (sizes []uint8, err error) {
|
||||
|
||||
var sizeSlice []uint8
|
||||
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
if v.Sizes == nil || len(v.Sizes) == 0 {
|
||||
return
|
||||
}
|
||||
for _, s := range v.Sizes {
|
||||
if sizeSlice, err = s.Sizes(); err != nil {
|
||||
return
|
||||
}
|
||||
sizes = append(sizes, sizeSlice...)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user