const ChangeCauseAnnotation … type RecordFlags … // ToRecorder returns a ChangeCause recorder if --record=false was not // explicitly given by the user func (f *RecordFlags) ToRecorder() (Recorder, error) { … } // Complete is called before the command is run, but after it is invoked to finish the state of the struct before use. func (f *RecordFlags) Complete(cmd *cobra.Command) error { … } // CompleteWithChangeCause alters changeCause value with a new cause func (f *RecordFlags) CompleteWithChangeCause(cause string) error { … } // AddFlags binds the requested flags to the provided flagset // TODO have this only take a flagset func (f *RecordFlags) AddFlags(cmd *cobra.Command) { … } // NewRecordFlags provides a RecordFlags with reasonable default values set for use func NewRecordFlags() *RecordFlags { … } type Recorder … type NoopRecorder … // Record implements Recorder func (r NoopRecorder) Record(obj runtime.Object) error { … } // MakeRecordMergePatch implements Recorder func (r NoopRecorder) MakeRecordMergePatch(obj runtime.Object) ([]byte, error) { … } type ChangeCauseRecorder … // Record annotates a "change-cause" to a given info if either "shouldRecord" is true, // or the resource info previously contained a "change-cause" annotation. func (r *ChangeCauseRecorder) Record(obj runtime.Object) error { … } // MakeRecordMergePatch produces a merge patch for updating the recording annotation. func (r *ChangeCauseRecorder) MakeRecordMergePatch(obj runtime.Object) ([]byte, error) { … } // parseCommandArguments will stringify and return all environment arguments ie. a command run by a client // using the factory. // Set showSecrets false to filter out stuff like secrets. func parseCommandArguments(cmd *cobra.Command) string { … }