author | Alberto Bertogli
<albertito@blitiri.com.ar> 2016-09-25 19:52:50 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2016-10-09 23:51:04 UTC |
parent | 935494429d1a1ab9f7917cdd5a17a807855488ba |
cmd/chasquid-util/chasquid-util.go | +14 | -0 |
diff --git a/cmd/chasquid-util/chasquid-util.go b/cmd/chasquid-util/chasquid-util.go index 3d737e6..50df5b1 100644 --- a/cmd/chasquid-util/chasquid-util.go +++ b/cmd/chasquid-util/chasquid-util.go @@ -14,6 +14,7 @@ import ( "blitiri.com.ar/go/chasquid/internal/userdb" "github.com/docopt/docopt-go" + "github.com/golang/protobuf/proto" "golang.org/x/crypto/ssh/terminal" ) @@ -25,6 +26,7 @@ Usage: chasquid-util authenticate <db> <username> [--password=<password>] chasquid-util check-userdb <db> chasquid-util aliases-resolve <configdir> <address> + chasquid-util print-config <configdir> ` // Command-line arguments. @@ -39,6 +41,7 @@ func main() { "authenticate": Authenticate, "check-userdb": CheckUserDB, "aliases-resolve": AliasesResolve, + "print-config": PrintConfig, } for cmd, f := range commands { @@ -196,3 +199,14 @@ func AliasesResolve() { } } + +// chasquid-util print-config <configdir> +func PrintConfig() { + configDir := args["<configdir>"].(string) + conf, err := config.Load(configDir + "/chasquid.conf") + if err != nil { + Fatalf("Error reading config") + } + + fmt.Println(proto.MarshalTextString(conf)) +}