<commit_before>package cmd

import (
	"fmt"

	"github.com/mpreath/netcalc/ipv4"
	"github.com/mpreath/netcalc/ipv4/network"
	"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
	Use:   "netcalc",
	Short: "Netcalc is a IPv4/IPv6 network calculator",
	Run: func(cmd *cobra.Command, args []string) {
		// do stuff here
		n, err := network.GenerateNetwork("192.168.1.90", "255.255.255.252")
		if err != nil {
			fmt.Print(err)
			return
		}
		n_dd_address, _ := ipv4.Itodd(n.Address)
		n_dd_mask, _ := ipv4.Itodd(n.Mask)
		n_dd_bcast, _ := ipv4.Itodd(n.BroadcastAddress)
		fmt.Printf("Network: { Address: \"%s\", Mask: \"%s\", BroadcastAddress: \"%s\", Host Count: %d }\n", n_dd_address, n_dd_mask, n_dd_bcast, len(n.Hosts))
	},
}

func Execute() error {
	return rootCmd.Execute()
}<commit_msg>organized root cmd<commit_after>package cmd

import (
	"fmt"

	"github.com/mpreath/netcalc/ipv4"
	"github.com/mpreath/netcalc/ipv4/network"
	"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
	Use:   "netcalc",
	Short: "Netcalc is a IPv4/IPv6 network calculator",
	Run: func(cmd *cobra.Command, args []string) {
		n, err := network.GenerateNetwork("192.168.1.1", "255.255.255.0")
		if err != nil {
			fmt.Print(err)
			return
		}
		printNetworkInformation(n)
	},
}

func Execute() error {
	return rootCmd.Execute()
}

func printNetworkInformation(n *network.Network) {
	n_dd_address, _ := ipv4.Itodd(n.Address)
	n_dd_mask, _ := ipv4.Itodd(n.Mask)
	n_dd_bcast, _ := ipv4.Itodd(n.BroadcastAddress)

	fmt.Printf("Network:\t%s\n", n_dd_address)
	fmt.Printf("Mask:\t\t%s\n", n_dd_mask)
	fmt.Printf("Broadcast:\t%s\n", n_dd_bcast)
	fmt.Printf("Usable Hosts:\t%d\n", len(n.Hosts))
}

func printNetworkInformationJSON(network *network.Network) {
}
{'fraction_non_alphanumeric': 0.17403790924755888, 'fraction_numerical': 0.032739804709936815, 'mean_word_length': 4.310975609756097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6217912', 'n_tokens_mistral': 792, 'n_tokens_neox': 746, 'n_words': 124}