Created
August 8, 2019 10:16
-
-
Save Prnyself/bbe01d7f7c54eafd6afc1d1792357d46 to your computer and use it in GitHub Desktop.
base flag handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package action | |
// FlagHandler contains all flags from cmd | |
type FlagHandler struct { | |
Bench bool `json:"bench"` | |
ExpectSize int64 `json:"expect_size"` | |
Format string `json:"format"` | |
HumanReadable bool `json:"human_readable"` | |
LongFormat bool `json:"long_format"` | |
MaximumMemoryContent int64 `json:"maximum_memory_content"` | |
Recursive bool `json:"recursive"` | |
Reverse bool `json:"reverse"` | |
Zone string `json:"zone"` | |
} | |
// WithBench sets flag handler with given bench flag | |
func (fh *FlagHandler) WithBench(b bool) *FlagHandler { | |
fh.Bench = b | |
return fh | |
} | |
// WithExpectSize sets flag handler with given expect_size flag | |
func (fh *FlagHandler) WithExpectSize(size int64) *FlagHandler { | |
fh.ExpectSize = size | |
return fh | |
} | |
// WithFormat sets flag handler with given format flag | |
func (fh *FlagHandler) WithFormat(f string) *FlagHandler { | |
fh.Format = f | |
return fh | |
} | |
// WithHumanReadable sets flag handler with given human_readable flag | |
func (fh *FlagHandler) WithHumanReadable(h bool) *FlagHandler { | |
fh.HumanReadable = h | |
return fh | |
} | |
// WithLongFormat sets flag handler with given long_format flag | |
func (fh *FlagHandler) WithLongFormat(l bool) *FlagHandler { | |
fh.LongFormat = l | |
return fh | |
} | |
// WithMaximumMemory sets flag handler with given maximum_memory_content flag | |
func (fh *FlagHandler) WithMaximumMemory(maxMemory int64) *FlagHandler { | |
fh.MaximumMemoryContent = maxMemory | |
return fh | |
} | |
// WithRecursive sets flag handler with given recursive flag | |
func (fh *FlagHandler) WithRecursive(r bool) *FlagHandler { | |
fh.Recursive = r | |
return fh | |
} | |
// WithReverse sets flag handler with given reverse flag | |
func (fh *FlagHandler) WithReverse(r bool) *FlagHandler { | |
fh.Reverse = r | |
return fh | |
} | |
// WithZone sets flag handler with given zone flag | |
func (fh *FlagHandler) WithZone(z string) *FlagHandler { | |
fh.Zone = z | |
return fh | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment