Browse Source

Ignore targets in lutractl status command

master
Dashie der otter 1 year ago
parent
commit
3ed481f43c
Signed by: Dashie <dashie@sigpipe.me> GPG Key ID: C2D57B325840B755
2 changed files with 15 additions and 0 deletions
  1. 4
    0
      lutractl/status.go
  2. 11
    0
      shared/ipc/ipc.go

+ 4
- 0
lutractl/status.go View File

@@ -40,6 +40,10 @@ func getStatus(ctx *cli.Context) error {
}

for _, loadedService := range resIpc {
if loadedService.IsTarget() {
continue // Ignore targets
}

fmt.Printf("Service: %s, of type %s\n", loadedService.Name, loadedService.Type)
fmt.Printf("Description: %s\n", loadedService.Description)
if loadedService.Deleted {

+ 11
- 0
shared/ipc/ipc.go View File

@@ -2,6 +2,7 @@ package ipc

import (
"regexp"
"strings"
)

// WARNING: Huges parts of this file should be synced with content of lutrainit/lutrainit/service.go
@@ -196,3 +197,13 @@ var IsCustASCII = regexp.MustCompile(`^[a-zA-Z0-9_\-.]+$`).MatchString

// IsCustASCIISpace is a custom regexp checker for sanity with a space !!!
var IsCustASCIISpace = regexp.MustCompile(`^[a-zA-Z0-9_\-. ]+$`).MatchString

// IsService or not
func (s Service) IsService() bool {
return strings.HasSuffix(string(s.Name), ".service")
}

// IsTarget or not
func (s Service) IsTarget() bool {
return strings.HasSuffix(string(s.Name), ".target")
}

Loading…
Cancel
Save