sshpiper/plugin/yaml/main.go
Boshi Lian 14ceadb8e8
add skel plugin for code sharing (#473)
* introduce plugin skel to reuse code

* Refactor code to use libplugin.NewSkelPlugin for plugin/kubernetes/main.go
Add YAML Plugin skel.go for plugin/yaml

* Fix code scanning alert no. 6: Incorrect conversion between integer types

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* fix gpt

* fjx password handling in SkelPlugin and skelpipeToWrapper

* go fmt

* Refactor Docker plugin to use skelpipe wrapper

* Refactor skel.go to use container username instead of client username

* revert yaml test order

* fix public and password mess up

* Refactor working dir to use skel

* revert deleted file

* Refactor skel.go to remove unused code and simplify MatchConn function

* Refactor skel.go to read userKnownHosts file in KnownHosts function

* remove workingdirbykey from goreleaser

* Refactor workingdir.go to use libplugin.SplitHostPortForSSH for parsing host and port

* Refactor skel.go to remove unused code and simplify MatchConn function

* merge doc into workingdir

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2024-10-24 23:15:26 -07:00

36 lines
878 B
Go

//go:build full || e2e
package main
import (
"github.com/tg123/sshpiper/libplugin"
"github.com/urfave/cli/v2"
)
func main() {
plugin := newYamlPlugin()
libplugin.CreateAndRunPluginTemplate(&libplugin.PluginTemplate{
Name: "yaml",
Usage: "sshpiperd yaml plugin",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Usage: "path to yaml config file",
Required: true,
EnvVars: []string{"SSHPIPERD_YAML_CONFIG"},
Destination: &plugin.File,
},
&cli.BoolFlag{
Name: "no-check-perm",
Usage: "disable 0400 checking",
EnvVars: []string{"SSHPIPERD_YAML_NOCHECKPERM"},
Destination: &plugin.NoCheckPerm,
},
},
CreateConfig: func(c *cli.Context) (*libplugin.SshPiperPluginConfig, error) {
skel := libplugin.NewSkelPlugin(plugin.listPipe)
return skel.CreateConfig(), nil
},
})
}