- Initialize Go module with dependencies - Create core mining package with Manager, Miner, and MinerConfig - Implement comprehensive tests with 100% coverage - Create CLI using Cobra with start, stop, list, status commands - Add demo main.go for development and testing - Configure CodeRabbit for automated reviews - Configure GoReleaser for multi-platform releases - Add EUPL-1.2 license - Create Makefile with common targets - Update README with badges and documentation - Add .gitignore for Go projects Co-authored-by: Snider <631881+Snider@users.noreply.github.com>
30 lines
575 B
Go
30 lines
575 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// stopCmd represents the stop command
|
|
var stopCmd = &cobra.Command{
|
|
Use: "stop [miner-id]",
|
|
Short: "Stop a running miner",
|
|
Long: `Stop a running miner by its ID.`,
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
minerID := args[0]
|
|
|
|
err := getManager().StopMiner(minerID)
|
|
if err != nil {
|
|
return fmt.Errorf("failed to stop miner: %w", err)
|
|
}
|
|
|
|
fmt.Printf("Miner %s stopped successfully\n", minerID)
|
|
return nil
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(stopCmd)
|
|
}
|