diff --git a/cmd/export.go b/cmd/export.go index a51de7a..f6628ec 100644 --- a/cmd/export.go +++ b/cmd/export.go @@ -15,8 +15,8 @@ var exportCmd = &cobra.Command{ Use: "export", Short: "Export current ipam configuration (not implemented)", Long: `Export current ipam contents to importable data format. - - Not implemented yet.`, + + Not implemented yet.`, Run: func(cmd *cobra.Command, args []string) { fmt.Println("Not implemented") }, diff --git a/cmd/import.go b/cmd/import.go index 7bb4f83..edebe9c 100644 --- a/cmd/import.go +++ b/cmd/import.go @@ -15,8 +15,8 @@ var importCmd = &cobra.Command{ Use: "import", Short: "Import ipam configuration (not implemented)", Long: `Import ips and subnets to ipam. - - Not implemented yet.`, + + Not implemented yet.`, Run: func(cmd *cobra.Command, args []string) { fmt.Println("Not implemented") }, diff --git a/cmd/root.go b/cmd/root.go index 1711aab..cf96f40 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -63,7 +63,7 @@ func initConfig() { viper.SetConfigType("yaml") viper.SetDefault("DataPath", ipamdir+"data/") - viper.SetDefault("EnablePowerDNS", false) + viper.SetDefault("PowerDNSEnabled", false) viper.SetDefault("PowerDNSEndpoint", "") viper.SetDefault("PowerDNSApiKey", "") diff --git a/cmd/subnet-list.go b/cmd/subnet-list.go index 1efd4af..333c888 100644 --- a/cmd/subnet-list.go +++ b/cmd/subnet-list.go @@ -22,7 +22,7 @@ var subnetlistCmd = &cobra.Command{ Args: cobra.ExactArgs(0), Example: "cmdb subnet list", Run: func(cmd *cobra.Command, args []string) { - verbose, _ := cmd.Flags().GetBool("verbose") + //verbose, _ := cmd.Flags().GetBool("verbose") subnetlist := ListSubnets() var subnets []Subnet @@ -40,21 +40,21 @@ var subnetlistCmd = &cobra.Command{ }) for _, subnet := range subnets { - if verbose { - var numip, freeip int + //if verbose { + var numip, freeip int - if subnet.Subnet.Addr().Is4() { - hostbits := float64(32 - subnet.Subnet.Bits()) - numip = int(math.Pow(2, hostbits)) - 2 - freeip = numip - len(subnet.Addresses) + if subnet.Subnet.Addr().Is4() { + hostbits := float64(32 - subnet.Subnet.Bits()) + numip = int(math.Pow(2, hostbits)) - 2 + freeip = numip - len(subnet.Addresses) - fmt.Printf("%v:\t%v\t(vl: %v)\tfree: %v\n", subnet.Subnet, subnet.Name, subnet.Vlan, freeip) - } else { - fmt.Printf("%v:\t%v\t(vl: %v)\n", subnet.Subnet, subnet.Name, subnet.Vlan) - } + fmt.Printf("%v:\t%v\t(vl: %v)\tfree: %v\n", subnet.Subnet, subnet.Name, subnet.Vlan, freeip) } else { fmt.Printf("%v:\t%v\t(vl: %v)\n", subnet.Subnet, subnet.Name, subnet.Vlan) } + //} else { + // fmt.Printf("%v:\t%v\t(vl: %v)\n", subnet.Subnet, subnet.Name, subnet.Vlan) + //} } }, @@ -71,5 +71,5 @@ func init() { // Cobra supports local flags which will only run when this command // is called directly, e.g.: - subnetlistCmd.Flags().BoolP("verbose", "v", false, "Show verbose output like free IPs") + // subnetlistCmd.Flags().BoolP("verbose", "v", false, "Show verbose output like free IPs") } diff --git a/go.mod b/go.mod index 8be96db..d129b9f 100644 --- a/go.mod +++ b/go.mod @@ -5,20 +5,20 @@ go 1.20 require github.com/spf13/cobra v1.6.1 require ( - github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/magiconair/properties v1.8.7 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/pelletier/go-toml/v2 v2.0.6 // indirect - github.com/spf13/afero v1.9.3 // indirect - github.com/spf13/cast v1.5.0 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.15.0 // indirect - github.com/subosito/gotenv v1.4.2 // indirect - golang.org/x/sys v0.3.0 // indirect - golang.org/x/text v0.5.0 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/pelletier/go-toml/v2 v2.0.6 // indirect + github.com/spf13/afero v1.9.3 // indirect + github.com/spf13/cast v1.5.0 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.15.0 // indirect + github.com/subosito/gotenv v1.4.2 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect )