NewNameEncryptionMode turns a string into a NameEncryptionMode
(s string)
| 88 | |
| 89 | // NewNameEncryptionMode turns a string into a NameEncryptionMode |
| 90 | func NewNameEncryptionMode(s string) (mode NameEncryptionMode, err error) { |
| 91 | s = strings.ToLower(s) |
| 92 | switch s { |
| 93 | case "off": |
| 94 | mode = NameEncryptionOff |
| 95 | case "standard": |
| 96 | mode = NameEncryptionStandard |
| 97 | case "obfuscate": |
| 98 | mode = NameEncryptionObfuscated |
| 99 | default: |
| 100 | err = fmt.Errorf("unknown file name encryption mode %q", s) |
| 101 | } |
| 102 | return mode, err |
| 103 | } |
| 104 | |
| 105 | // String turns mode into a human-readable string |
| 106 | func (mode NameEncryptionMode) String() (out string) { |
searching dependent graphs…