- Remove internal/cmd/php/ (now core/php repo) - Remove internal/cmd/ci/ and internal/cmd/sdk/ (now core/ci repo) - Remove internal/variants/ build tag system entirely - Move all 30 remaining command packages from internal/cmd/ to cmd/ - Rewrite main.go with direct imports (no more variant selection) - Update all cross-references from internal/cmd/ to cmd/ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
58 lines
1.3 KiB
Go
58 lines
1.3 KiB
Go
package collect
|
|
|
|
import (
|
|
"context"
|
|
|
|
"forge.lthn.ai/core/go/pkg/cli"
|
|
"forge.lthn.ai/core/go/pkg/collect"
|
|
"forge.lthn.ai/core/go/pkg/i18n"
|
|
)
|
|
|
|
// Market command flags
|
|
var (
|
|
marketHistorical bool
|
|
marketFromDate string
|
|
)
|
|
|
|
// addMarketCommand adds the 'market' subcommand to the collect parent.
|
|
func addMarketCommand(parent *cli.Command) {
|
|
marketCmd := &cli.Command{
|
|
Use: "market <coin>",
|
|
Short: i18n.T("cmd.collect.market.short"),
|
|
Long: i18n.T("cmd.collect.market.long"),
|
|
Args: cli.ExactArgs(1),
|
|
RunE: func(cmd *cli.Command, args []string) error {
|
|
return runMarket(args[0])
|
|
},
|
|
}
|
|
|
|
cli.BoolFlag(marketCmd, &marketHistorical, "historical", "H", false, i18n.T("cmd.collect.market.flag.historical"))
|
|
cli.StringFlag(marketCmd, &marketFromDate, "from", "f", "", i18n.T("cmd.collect.market.flag.from"))
|
|
|
|
parent.AddCommand(marketCmd)
|
|
}
|
|
|
|
func runMarket(coinID string) error {
|
|
cfg := newConfig()
|
|
setupVerboseLogging(cfg)
|
|
|
|
collector := &collect.MarketCollector{
|
|
CoinID: coinID,
|
|
Historical: marketHistorical,
|
|
FromDate: marketFromDate,
|
|
}
|
|
|
|
if cfg.DryRun {
|
|
cli.Info("Dry run: would collect market data for " + coinID)
|
|
return nil
|
|
}
|
|
|
|
ctx := context.Background()
|
|
result, err := collector.Collect(ctx, cfg)
|
|
if err != nil {
|
|
return cli.Wrap(err, "market collection failed")
|
|
}
|
|
|
|
printResult(result)
|
|
return nil
|
|
}
|