diff options
| author | Paul Bütow <pbuetow@mimecast.com> | 2020-02-16 13:58:26 +0000 |
|---|---|---|
| committer | Paul Bütow <pbuetow@mimecast.com> | 2020-02-16 13:58:26 +0000 |
| commit | 6bca637513e065a33cadaccad97ada25eb7a6b00 (patch) | |
| tree | d08a4c8ee40aba985c82184c20606de7debd42b1 /cmd | |
| parent | 86ecab818a6089f6da7267463edbc5300ddc155c (diff) | |
can upload script via drun
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/drun/main.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/cmd/drun/main.go b/cmd/drun/main.go index b1936d4..1b88b1b 100644 --- a/cmd/drun/main.go +++ b/cmd/drun/main.go @@ -3,6 +3,7 @@ package main import ( "context" "flag" + "io/ioutil" "os" "github.com/mimecast/dtail/internal/clients" @@ -67,7 +68,7 @@ func main() { ServersStr: serversStr, Discovery: discovery, UserName: userName, - What: command, + What: readCommand(command), TrustAllHosts: trustAllHosts, } @@ -80,3 +81,16 @@ func main() { logger.Flush() os.Exit(status) } + +func readCommand(command string) string { + if _, err := os.Stat(command); os.IsNotExist(err) { + return command + } + + bytes, err := ioutil.ReadFile(command) + if err != nil { + panic(err) + } + + return string(bytes) +} |
