Documentation ¶
Overview ¶
Package cmd is a generated GoMock package.
Index ¶
- Variables
- type MockBackend
- func (m *MockBackend) EXPECT() *MockBackendMockRecorder
- func (m *MockBackend) Exists() (bool, error)
- func (m *MockBackend) ExistsContext(arg0 context.Context) (bool, error)
- func (m *MockBackend) Load() ([]byte, error)
- func (m *MockBackend) LoadContext(arg0 context.Context) ([]byte, error)
- func (m *MockBackend) Save(arg0 []byte) error
- func (m *MockBackend) SaveContext(arg0 context.Context, arg1 []byte) error
- type MockBackendMockRecorder
- func (mr *MockBackendMockRecorder) Exists() *gomock.Call
- func (mr *MockBackendMockRecorder) ExistsContext(arg0 interface{}) *gomock.Call
- func (mr *MockBackendMockRecorder) Load() *gomock.Call
- func (mr *MockBackendMockRecorder) LoadContext(arg0 interface{}) *gomock.Call
- func (mr *MockBackendMockRecorder) Save(arg0 interface{}) *gomock.Call
- func (mr *MockBackendMockRecorder) SaveContext(arg0, arg1 interface{}) *gomock.Call
Constants ¶
This section is empty.
Variables ¶
var RootCmd = &cobra.Command{ Use: "scrt", Short: "A secret manager for the command-line", PersistentPreRunE: func(cmd *cobra.Command, args []string) error { if cmd == storageCmd { return nil } err := readConfig(cmd) if err != nil { return err } if verbose { logger = &log.Logger{Handler: cli.Default} } else { logger = &log.Logger{Handler: discard.Default} } cmdContext = log.NewContext( cmdContext, logger, ) if !viper.IsSet(configKeyStorage) { for k := range backend.Backends { if viper.InConfig(k) { viper.Set(configKeyStorage, k) break } } if !viper.IsSet(configKeyStorage) { return fmt.Errorf("missing storage type") } } if !viper.IsSet(configKeyPassword) { return fmt.Errorf("missing password") } storage := viper.GetString(configKeyStorage) factory, ok := backend.Backends[storage] if !ok { return fmt.Errorf("unknown storage type: %s", storage) } cmd.FParseErrWhitelist.UnknownFlags = false cmd.Flags().AddFlagSet(factory.Flags()) err = viper.BindPFlags(cmd.Flags()) if err != nil { return err } err = cmd.ParseFlags(os.Args[1:]) if err != nil { return cmd.FlagErrorFunc()(cmd, err) } if viper.ConfigFileUsed() != "" { logger. WithField("path", viper.ConfigFileUsed()). Infof("read configuration file") } settings := make(map[string]interface{}) for k, v := range viper.AllSettings() { if k != configKeyPassword && !reflect.ValueOf(v).IsZero() { settings[k] = v } } logger. WithFields(fielder{fields: settings}). Info("using configuration") cmd.SilenceUsage = true return nil }, }
RootCmd is the root command for scrt.
Functions ¶
This section is empty.
Types ¶
type MockBackend ¶
type MockBackend struct {
// contains filtered or unexported fields
}
MockBackend is a mock of Backend interface.
func NewMockBackend ¶
func NewMockBackend(ctrl *gomock.Controller) *MockBackend
NewMockBackend creates a new mock instance.
func (*MockBackend) EXPECT ¶
func (m *MockBackend) EXPECT() *MockBackendMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockBackend) ExistsContext ¶ added in v0.3.3
func (m *MockBackend) ExistsContext(arg0 context.Context) (bool, error)
ExistsContext mocks base method.
func (*MockBackend) LoadContext ¶ added in v0.3.3
func (m *MockBackend) LoadContext(arg0 context.Context) ([]byte, error)
LoadContext mocks base method.
func (*MockBackend) SaveContext ¶ added in v0.3.3
func (m *MockBackend) SaveContext(arg0 context.Context, arg1 []byte) error
SaveContext mocks base method.
type MockBackendMockRecorder ¶
type MockBackendMockRecorder struct {
// contains filtered or unexported fields
}
MockBackendMockRecorder is the mock recorder for MockBackend.
func (*MockBackendMockRecorder) Exists ¶
func (mr *MockBackendMockRecorder) Exists() *gomock.Call
Exists indicates an expected call of Exists.
func (*MockBackendMockRecorder) ExistsContext ¶ added in v0.3.3
func (mr *MockBackendMockRecorder) ExistsContext(arg0 interface{}) *gomock.Call
ExistsContext indicates an expected call of ExistsContext.
func (*MockBackendMockRecorder) Load ¶
func (mr *MockBackendMockRecorder) Load() *gomock.Call
Load indicates an expected call of Load.
func (*MockBackendMockRecorder) LoadContext ¶ added in v0.3.3
func (mr *MockBackendMockRecorder) LoadContext(arg0 interface{}) *gomock.Call
LoadContext indicates an expected call of LoadContext.
func (*MockBackendMockRecorder) Save ¶
func (mr *MockBackendMockRecorder) Save(arg0 interface{}) *gomock.Call
Save indicates an expected call of Save.
func (*MockBackendMockRecorder) SaveContext ¶ added in v0.3.3
func (mr *MockBackendMockRecorder) SaveContext(arg0, arg1 interface{}) *gomock.Call
SaveContext indicates an expected call of SaveContext.