Some checks failed
E2E Tests / E2E Tests (push) Failing after 1m23s
Tests / Go Tests (push) Failing after 39s
Desktop Release / Build linux (push) Failing after 46s
Release / Test (push) Failing after 2s
Tests / C++ Tests (push) Failing after 1m12s
Release / Release (push) Has been cancelled
Desktop Release / Build darwin (push) Has been cancelled
Desktop Release / Build windows (push) Has been cancelled
Desktop Release / Create Release (push) Has been cancelled
Move module declaration and all internal imports from github.com/Snider/Mining to forge.lthn.ai/Snider/Mining. Also updates Borg, Enchantrix, and Poindexter dependency paths to forge.lthn.ai. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package cmd
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"forge.lthn.ai/Snider/Mining/pkg/mining"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
minerPool string
|
|
minerWallet string
|
|
)
|
|
|
|
// startCmd represents the start command
|
|
var startCmd = &cobra.Command{
|
|
Use: "start [miner_name]",
|
|
Short: "Start a new miner",
|
|
Long: `Start a new miner with the specified configuration.`,
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
minerType := args[0]
|
|
config := &mining.Config{
|
|
Pool: minerPool,
|
|
Wallet: minerWallet,
|
|
}
|
|
|
|
miner, err := getManager().StartMiner(context.Background(), minerType, config)
|
|
if err != nil {
|
|
return fmt.Errorf("failed to start miner: %w", err)
|
|
}
|
|
|
|
fmt.Printf("Miner started successfully:\n")
|
|
fmt.Printf(" Name: %s\n", miner.GetName())
|
|
return nil
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(startCmd)
|
|
startCmd.Flags().StringVarP(&minerPool, "pool", "p", "", "Mining pool address (required)")
|
|
startCmd.Flags().StringVarP(&minerWallet, "wallet", "w", "", "Wallet address (required)")
|
|
_ = startCmd.MarkFlagRequired("pool")
|
|
_ = startCmd.MarkFlagRequired("wallet")
|
|
}
|