-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlifecycle_cmd.go
More file actions
70 lines (54 loc) · 1.63 KB
/
lifecycle_cmd.go
File metadata and controls
70 lines (54 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright 2025-2026 : Nawa Manusitthipol
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
package main
import (
"fmt"
"os"
"github.com/nawaman/codingbooth/src/pkg/lifecycle"
)
func listBooths(_ string) {
handleLifecycleErr(lifecycle.List(os.Args[2:], os.Stdout, os.Stderr))
}
func startBooth(_ string) {
handleLifecycleErr(lifecycle.Start(os.Args[2:], os.Stderr))
}
func stopBooth(_ string) {
handleLifecycleErr(lifecycle.Stop(os.Args[2:], os.Stderr))
}
func restartBooth(_ string) {
handleLifecycleErr(lifecycle.Restart(os.Args[2:], os.Stderr))
}
func removeBooth(_ string) {
handleLifecycleErr(lifecycle.Remove(os.Args[2:], os.Stderr))
}
func pruneBooths(_ string) {
handleLifecycleErr(lifecycle.Prune(os.Args[2:], os.Stdin, os.Stdout, os.Stderr))
}
func shellBooth(_ string) {
handleLifecycleErr(lifecycle.Shell(os.Args[2:], os.Stderr))
}
func execBooth(_ string) {
handleLifecycleErr(lifecycle.Exec(os.Args[2:], os.Stderr))
}
func messageBooth(_ string) {
handleLifecycleErr(lifecycle.Message(os.Args[2:], os.Stdout, os.Stderr))
}
func listHomeVolumes(_ string) {
handleLifecycleErr(lifecycle.ListHomeVolume(os.Args[2:], os.Stdout, os.Stderr))
}
func exportHomeVolume(_ string) {
handleLifecycleErr(lifecycle.ExportHomeVolume(os.Args[2:], os.Stdout, os.Stderr))
}
func importHomeVolume(_ string) {
handleLifecycleErr(lifecycle.ImportHomeVolume(os.Args[2:], os.Stdout, os.Stderr))
}
func handleLifecycleErr(err error) {
if err == nil {
return
}
if err.Error() != "" {
fmt.Fprintln(os.Stderr, err)
}
os.Exit(lifecycle.ExitCode(err))
}