From f085edf220bf1f681efee53ef1e91a1123bd12a7 Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Wed, 6 Apr 2022 17:23:19 -0500 Subject: [PATCH] :sparkles: Add Pipe shorthand --- cmd/dump/dump.go | 4 ++-- cmd/restore/restore.go | 2 +- internal/command/raw.go | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/dump/dump.go b/cmd/dump/dump.go index f84eda7..694bd24 100644 --- a/cmd/dump/dump.go +++ b/cmd/dump/dump.go @@ -213,9 +213,9 @@ func run(cmd *cobra.Command, args []string) (err error) { func buildCommand(db config.Databaser, conf config.Dump) *command.Builder { cmd := db.DumpCommand(conf) if conf.Format != sqlformat.Custom { - cmd.Push(command.Raw("|"), "gzip", "--force") + cmd.Push(command.Pipe, "gzip", "--force") } // base64 is required since TTYs use CRLF - cmd.Push(command.Raw("|"), "base64", "-w0") + cmd.Push(command.Pipe, "base64", "-w0") return cmd } diff --git a/cmd/restore/restore.go b/cmd/restore/restore.go index 9e2fe65..f86074d 100644 --- a/cmd/restore/restore.go +++ b/cmd/restore/restore.go @@ -159,7 +159,7 @@ func run(cmd *cobra.Command, args []string) (err error) { func buildCommand(conf config.Restore, inputFormat sqlformat.Format) *command.Builder { return conf.Grammar.RestoreCommand(conf, inputFormat). - Unshift("gunzip", "--force", command.Raw("|")) + Unshift("gunzip", "--force", command.Pipe) } func gzipCopy(w io.Writer, r io.Reader) (err error) { diff --git a/internal/command/raw.go b/internal/command/raw.go index d499c08..b6ce1f7 100644 --- a/internal/command/raw.go +++ b/internal/command/raw.go @@ -1,3 +1,5 @@ package command type Raw string + +const Pipe = Raw("|")