// Package lemcmd provides CLI commands for the LEM binary. // Commands register through the Core framework's cli.WithCommands lifecycle. package lemcmd import ( "fmt" "os" "path/filepath" "strings" "forge.lthn.ai/core/cli/pkg/cli" ) // AddLEMCommands registers all LEM command groups on the root command. func AddLEMCommands(root *cli.Command) { addScoreCommands(root) addGenCommands(root) addDataCommands(root) addExportCommands(root) addMonCommands(root) addInfraCommands(root) } // envOr returns the environment variable value, or the fallback if not set. func envOr(key, fallback string) string { if v := os.Getenv(key); v != "" { return v } return fallback } // intEnvOr returns the environment variable value parsed as int, or the fallback. func intEnvOr(key string, fallback int) int { v := os.Getenv(key) if v == "" { return fallback } var n int fmt.Sscanf(v, "%d", &n) if n == 0 { return fallback } return n } // expandHome expands a leading ~/ to the user's home directory. func expandHome(path string) string { if strings.HasPrefix(path, "~/") { home, err := os.UserHomeDir() if err == nil { return filepath.Join(home, path[2:]) } } return path }