alajmo / sake

:robot: sake is a task runner for local and remote hosts

Home Page:https://sakecli.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Distinguish servers by server-name, port and user in output

dwarfi09 opened this issue · comments

Is your feature request related to a problem? Please describe

When you access multiple hosts with the same hostname but different ports (e.g. running multiple virtualized servers on one host) you can't distinguish one from each other in the output.

config-example:

servers:
  VM1:
    host: root@server:22001
  VM2:
    host: user@server:22002
  VM3:
    host: root@server:22003

Running a task like an os-prober will create:

 host               | OS                                           
--------------------+----------------------------------------------
 server             | Debian 11                                    
 server             | Debian 10                                    
 server             | Debian 11                                    

The information about the different servernames, ports etc. is missing

Describe the solution you'd like

The output should (optionally) contain information about the server-name (VM1, VM2, VM3 in the example above) and / or port and username.

Additional context

./.

Yes, I have that feature on the roadmap, pretty much similar solution to the header prefix you can customize in themes (uses go templates so you can use conditionals):

themes:
    default:
        text:
            prefix: true
            header: '{{ .Style "TASK" "bold" }}{{ if ne .NumTasks 1 }} ({{ .Index }}/{{ .NumTasks }}){{end}}{{ if and .Name .Desc }} [{{.Style .Name "bold"}}: {{ .Desc }}] {{ else if .Name }} [{{ .Name }}] {{ else if .Desc }} [{{ .Desc }}] {{end}}'
        table:

I'll try to implement it this week.

A bit late, but v0.14.0 now supports updating the prefix for text and table output:

themes:
  default:
    text:
      # Available variables: `.Name`, `.Index`, `.Host`, `.Port`, `.User`
      prefix: '{{.User}}@{{ .Host }}:{{.Port}}'

    table:
      # Available variables: `.Name`, `.Index`, `.Host`, `.Port`, `.User`
      prefix: '{{.User}}@{{ .Host }}:{{.Port}}'

Let me know if works!

This solves the problem perfectly! Thank you :)