From 91cd224c7f262013b7d44b3b3a9dbeacf3ced698 Mon Sep 17 00:00:00 2001 From: Carlos A Becker Date: Thu, 3 Feb 2022 15:58:56 -0300 Subject: [PATCH] config: add DecodeBytes to directly read a byte array Signed-off-by: Carlos A Becker --- AUTHORS.txt | 1 + Makefile | 3 +++ config.go | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/AUTHORS.txt b/AUTHORS.txt index 60a8b34..d306efb 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -1,3 +1,4 @@ +Carlos A Becker Dustin Spicuzza Eugene Terentev Kevin Burke diff --git a/Makefile b/Makefile index a1880d1..9c1e055 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,9 @@ race-test: lint $(BUMP_VERSION): go get -u github.com/kevinburke/bump_version +$(WRITE_MAILMAP): + go get -u github.com/kevinburke/write_mailmap + release: test | $(BUMP_VERSION) $(BUMP_VERSION) minor config.go diff --git a/config.go b/config.go index f6a4df3..a734e53 100644 --- a/config.go +++ b/config.go @@ -300,6 +300,12 @@ func Decode(r io.Reader) (*Config, error) { return decodeBytes(b, false, 0) } +// DecodeBytes reads b into a Config, or returns an error if r could not be +// parsed as an SSH config file. +func DecodeBytes(b []byte) (*Config, error) { + return decodeBytes(b, false, 0) +} + func decodeBytes(b []byte, system bool, depth uint8) (c *Config, err error) { defer func() { if r := recover(); r != nil {