mirror of
https://github.com/kemko/xc.git
synced 2026-01-01 15:55:43 +03:00
pass manager options and logging
This commit is contained in:
@@ -122,7 +122,7 @@ func New(cfg *config.XCConfig, backend store.Backend) (*Cli, error) {
|
||||
|
||||
if cfg.PasswordManagerPath != "" {
|
||||
term.Warnf("Loading password manager from %s\n", cfg.PasswordManagerPath)
|
||||
err = passmgr.Load(cfg.PasswordManagerPath)
|
||||
err = passmgr.Load(cfg.PasswordManagerPath, cfg.PasswordManagerOptions)
|
||||
if err != nil {
|
||||
term.Errorf("Error initializing password manager: %s\n", err)
|
||||
} else {
|
||||
@@ -482,6 +482,5 @@ func (c *Cli) setDistributeType(dtr string) {
|
||||
term.Errorf("Unknown distribute type: %s\n", dtr)
|
||||
return
|
||||
}
|
||||
term.Successf("distribute_type set to %s\n", dtr)
|
||||
remote.SetDistributeType(c.distributeType)
|
||||
}
|
||||
|
||||
@@ -159,6 +159,7 @@ func (c *Cli) doDistributeType(name string, argsLine string, args ...string) {
|
||||
return
|
||||
}
|
||||
c.setDistributeType(args[0])
|
||||
term.Successf("distribute_type set to %s\n", args[0])
|
||||
}
|
||||
|
||||
func (c *Cli) doPasswd(name string, argsLine string, args ...string) {
|
||||
|
||||
11
cli/help.go
11
cli/help.go
@@ -164,8 +164,15 @@ Rcfile is just a number of xc commands in a text file.`,
|
||||
"passmgr": &helpItem{
|
||||
isTopic: true,
|
||||
help: `Password manager is a golang plugin which must have two exported functions:
|
||||
func Init() error, which is called on xc start
|
||||
func GetPass(host string) (password string), which is kinda self-explanatory
|
||||
|
||||
func Init(options map[string]string, debugf func(string, ...interface{})) error
|
||||
func GetPass(host string) string
|
||||
|
||||
Init function is called on xc start passing all the options found in [passmgr] config section
|
||||
as a map[string]string, and a debugf function which logs to xc shared log if it's enabled.
|
||||
|
||||
GetPass function is called to acquire proper password for a host. Xc passes a hostname as the
|
||||
only argument and expects function to return a password.
|
||||
|
||||
For more info on how to write golang plugins, please refer to golang documentation or this article:
|
||||
https://medium.com/learning-the-go-programming-language/writing-modular-go-programs-with-plugins-ec46381ee1a9`,
|
||||
|
||||
Reference in New Issue
Block a user