Commit 15f850f0 authored by Brian Tiger Chow's avatar Brian Tiger Chow

refactor(2/main) helper methods for details object

License: MIT
Signed-off-by: default avatarBrian Tiger Chow <brian@perfmode.com>
parent 60af68bb
...@@ -76,10 +76,11 @@ func (d *cmdDetails) String() string { ...@@ -76,10 +76,11 @@ func (d *cmdDetails) String() string {
d.canRunOnClient(), d.canRunOnDaemon(), d.usesRepo()) d.canRunOnClient(), d.canRunOnDaemon(), d.usesRepo())
} }
func (d *cmdDetails) usesConfigAsInput() bool { return !d.doesNotUseConfigAsInput } func (d *cmdDetails) usesConfigAsInput() bool { return !d.doesNotUseConfigAsInput }
func (d *cmdDetails) canRunOnClient() bool { return !d.cannotRunOnClient } func (d *cmdDetails) doesNotPreemptAutoUpdate() bool { return !d.preemptsAutoUpdate }
func (d *cmdDetails) canRunOnDaemon() bool { return !d.cannotRunOnDaemon } func (d *cmdDetails) canRunOnClient() bool { return !d.cannotRunOnClient }
func (d *cmdDetails) usesRepo() bool { return !d.doesNotUseRepo } func (d *cmdDetails) canRunOnDaemon() bool { return !d.cannotRunOnDaemon }
func (d *cmdDetails) usesRepo() bool { return !d.doesNotUseRepo }
// "What is this madness!?" you ask. Our commands have the unfortunate problem of // "What is this madness!?" you ask. Our commands have the unfortunate problem of
// not being able to run on all the same contexts. This map describes these // not being able to run on all the same contexts. This map describes these
......
...@@ -219,7 +219,7 @@ func callPreCommandHooks(details cmdDetails, req cmds.Request, root *cmds.Comman ...@@ -219,7 +219,7 @@ func callPreCommandHooks(details cmdDetails, req cmds.Request, root *cmds.Comman
// check for updates when 1) commands is going to be run locally, 2) the // check for updates when 1) commands is going to be run locally, 2) the
// command does not initialize the config, and 3) the command does not // command does not initialize the config, and 3) the command does not
// pre-empt updates // pre-empt updates
if !daemon && details.usesConfigAsInput() && !details.preemptsAutoUpdate { if !daemon && details.usesConfigAsInput() && details.doesNotPreemptAutoUpdate() {
log.Debug("Calling hook: Check for updates") log.Debug("Calling hook: Check for updates")
...@@ -328,7 +328,6 @@ func commandDetails(path []string, root *cmds.Command) (*cmdDetails, error) { ...@@ -328,7 +328,6 @@ func commandDetails(path []string, root *cmds.Command) (*cmdDetails, error) {
details = cmdDetails details = cmdDetails
} }
} }
log.Debugf("cmd perms for +%v: %s", path, details.String())
return &details, nil return &details, nil
} }
......
...@@ -16,8 +16,8 @@ type Loggable interface { ...@@ -16,8 +16,8 @@ type Loggable interface {
Loggable() map[string]interface{} Loggable() map[string]interface{}
} }
// UniqueEvent returns a Metadata with the string key and UUID value // Uuid returns a Metadata with the string key and UUID value
func UniqueEvent(key string) Metadata { func Uuid(key string) Metadata {
return Metadata{ return Metadata{
key: uuid.New(), key: uuid.New(),
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment