<commit_before>package monitor

////////////////////////////////////////////////////////////////////////////////

import (
	"fmt"
	"time"

	"github.com/sabhiram/gomn/coin"
	"github.com/sabhiram/gomn/types"
)

////////////////////////////////////////////////////////////////////////////////

type Monitor struct {
	Coin *coin.Coin
	CLI  *types.CLI
}

func New(cli *types.CLI, opts []string) (*Monitor, error) {
	// What coin are we monitoring?
	c, err := coin.GetCoinByName(cli.Coin)
	if err != nil {
		return nil, err
	}

	// TODO: Verify that coin is correctly setup

	// TODO: Check to see if coin is running, if it is we are ok. If not and
	//       we do not have the --start option set, then we kick off the
	// 		 coin's daemon and wait for it to get going.

	return &Monitor{
		Coin: c,
		CLI:  cli,
	}, nil
}

////////////////////////////////////////////////////////////////////////////////

func (m *Monitor) Start() error {
	for {
		select {
		case <-time.After(1 * time.Second):
			fmt.Printf("Monitoring coin %s\n", m.Coin.GetName())
		}
	}
}

////////////////////////////////////////////////////////////////////////////////<commit_msg>Parse monitor options (just start for now)<commit_after>package monitor

////////////////////////////////////////////////////////////////////////////////

import (
	"flag"
	"fmt"
	"time"

	"github.com/sabhiram/gomn/coin"
	"github.com/sabhiram/gomn/types"
)

////////////////////////////////////////////////////////////////////////////////

type monitorOpts struct {
	start bool
}

func parseMonitorArgs(opts []string) (*monitorOpts, error) {
	args := &monitorOpts{}
	fs := flag.NewFlagSet("monitor", flag.ContinueOnError)
	fs.BoolVar(&args.start, "start", false, "start the coin daemon if it is not running")
	if err := fs.Parse(opts); err != nil {
		return nil, err
	}
	return args, nil
}

////////////////////////////////////////////////////////////////////////////////

type Monitor struct {
	Coin *coin.Coin
	CLI  *types.CLI
	Opts *monitorOpts
}

func New(cli *types.CLI, opts []string) (*Monitor, error) {
	// Parse monitor specific arguments.
	mopts, err := parseMonitorArgs(opts)
	if err != nil {
		return nil, err
	}

	// What coin are we monitoring?
	c, err := coin.GetCoinByName(cli.Coin)
	if err != nil {
		return nil, err
	}

	// TODO: Verify that coin is correctly setup

	// TODO: Check to see if coin is running, if it is we are ok. If not and
	//       we do not have the --start option set, then we kick off the
	// 		 coin's daemon and wait for it to get going.

	return &Monitor{
		Coin: c,
		CLI:  cli,
		Opts: mopts,
	}, nil
}

////////////////////////////////////////////////////////////////////////////////

func (m *Monitor) Start() error {
	for {
		select {
		case <-time.After(1 * time.Second):
			fmt.Printf("Monitoring coin %s\n", m.Coin.GetName())
		}
	}
}

////////////////////////////////////////////////////////////////////////////////
{'fraction_non_alphanumeric': 0.3471698113207547, 'fraction_numerical': 0.0006861063464837049, 'mean_word_length': 1.3033175355450237, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '612257', 'n_tokens_mistral': 871, 'n_tokens_neox': 844, 'n_words': 266}