MCPcopy
hub / github.com/SurgeDM/Surge / NewDownloadModel

Function NewDownloadModel

internal/tui/model.go:244–261  ·  view source on GitHub ↗

NewDownloadModel creates a new download model

(id string, url string, filename string, total int64)

Source from the content-addressed store, hash-verified

242
243// NewDownloadModel creates a new download model
244func NewDownloadModel(id string, url string, filename string, total int64) *DownloadModel {
245 // Create dummy state container for compatibility if needed
246 state := types.NewProgressState(id, total)
247 return &DownloadModel{
248 ID: id,
249 URL: url,
250 Filename: filename,
251 FilenameLower: strings.ToLower(filename),
252 Total: total,
253 StartTime: time.Now(),
254 progress: progress.New(
255 progress.WithSpringOptions(0.5, 0.1),
256 progress.WithColors(colors.ProgressStart(), colors.ProgressEnd()),
257 progress.WithScaled(true),
258 ),
259 state: state,
260 }
261}
262
263func InitialRootModel(serverPort int, currentVersion string, service core.DownloadService, orchestrator *processing.LifecycleManager, noResume bool, currentCommit ...string) RootModel {
264 initialDarkBackground := true

Calls 3

NewProgressStateFunction · 0.92
ProgressStartFunction · 0.92
ProgressEndFunction · 0.92