File tree Expand file tree Collapse file tree 3 files changed +47
-13
lines changed Expand file tree Collapse file tree 3 files changed +47
-13
lines changed Original file line number Diff line number Diff line change @@ -120,3 +120,22 @@ func (srv Service) Disable() error {
120120
121121 return nil
122122}
123+
124+ func (srv Service ) Status () error {
125+ status , err := srv .Service .Status ()
126+ if err != nil {
127+ return tracerr .Wrap (err )
128+ }
129+
130+ switch status {
131+ case service .StatusRunning :
132+ fmt .Println ("git-auto-sync-daemon is Running!" )
133+ case service .StatusStopped :
134+ fmt .Println ("git-auto-sync-daemon is NOT Running!" )
135+ case service .StatusUnknown :
136+ default :
137+ fmt .Println ("git-auto-sync-daemon status is Unknown. How mysterious!" )
138+ }
139+
140+ return nil
141+ }
Original file line number Diff line number Diff line change @@ -16,15 +16,31 @@ import (
1616
1717var errRepoPathInvalid = errors .New ("Not a valid git repo" )
1818
19- // func daemonStatus(ctx *cli.Context) error {
20- // FIXME: Implement 'daemonStatus'
19+ func daemonStatus (ctx * cli.Context ) error {
20+ s , err := common .NewService ()
21+ if err != nil {
22+ return tracerr .Wrap (err )
23+ }
24+
25+ err = s .Status ()
26+ if err != nil {
27+ return tracerr .Wrap (err )
28+ }
29+
30+ config , err := cfg .Read ()
31+ if err != nil {
32+ return tracerr .Wrap (err )
33+ }
2134
22- // Print out the configuration
23- // Print out uptime
24- // Print out if there are any 'rebasing' issues and we are paused
35+ fmt .Println ("Monitoring - " )
36+ for _ , repoPath := range config .Repos {
37+ fmt .Println (" " , repoPath )
38+ }
39+
40+ // FIXME: Print out if there are any 'rebasing' issues and we are paused
2541
26- // return nil
27- // }
42+ return nil
43+ }
2844
2945func daemonList (ctx * cli.Context ) error {
3046 config , err := cfg .Read ()
Original file line number Diff line number Diff line change @@ -104,12 +104,11 @@ func main() {
104104 Aliases : []string {"d" },
105105 Usage : "Interact with the background daemon" ,
106106 Subcommands : []* cli.Command {
107- // FIXME: Add a command to show the daemon's logs
108- // {
109- // Name: "status",
110- // Usage: "Show the Daemon's status",
111- // Action: daemonStatus,
112- // },
107+ {
108+ Name : "status" ,
109+ Usage : "Show the Daemon's status" ,
110+ Action : daemonStatus ,
111+ },
113112 {
114113 Name : "list" ,
115114 Aliases : []string {"ls" },
You can’t perform that action at this time.
0 commit comments