Skip to content
File

Blob: cmd/client/ls.go

go34 lines
1package client
2 
3import (
4 "context"
5 "os"
6 "os/signal"
7 "syscall"
8 
9 clientruntime "go.miragespace.co/specter/internal/client"
10 
11 "github.com/urfave/cli/v3"
12)
13 
14func cmdLs(ctx context.Context, cmd *cli.Command) error {
15 s := make(chan os.Signal, 1)
16 signal.Notify(s, syscall.SIGHUP)
17 defer signal.Stop(s)
18 
19 c, closeClient, err := clientruntime.OpenOwner(ctx, cmd.String("config"), runtimeOptions(cmd))
20 if err != nil {
21 return err
22 }
23 defer closeClient()
24 
25 hostnames, err := c.GetRegisteredHostnames(ctx)
26 if err != nil {
27 return err
28 }
29 
30 c.FormatList(hostnames, os.Stdout)
31 
32 return nil
33}